-
Notifications
You must be signed in to change notification settings - Fork 772
[ub] a few more fixes #7888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ub-ifndr
Are you sure you want to change the base?
[ub] a few more fixes #7888
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides the comments I left.
I may do a run over the wording again.
void *p = malloc(sizeof(int) + sizeof(float)); // undefined behavior, cannot create | ||
// both int and float in same place | ||
int& i = *reinterpret_cast<int*>(p); | ||
float& f = *reinterpret_cast<float*>(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be the point of UB?
CC @jensmaurer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the "malloc" is fine. The comment needs to move to line 34.
@@ -123,78 +127,184 @@ | |||
}; | |||
|
|||
float f() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float f() { | |
void f() { |
\pnum | ||
\begin{example} | ||
\begin{codeblock} | ||
int main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These next two examples are over indented, was that on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully not. Please fix.
This PR breaks up some
\ubdef
entries in the UB annex into multiple, more granular entries, for those cases of UB where there is value in distinguishing them. This PR makes the list of UB in theub-ifndr
branch identical to the list of UB provided in Appendix A of P3100R2.