-
Notifications
You must be signed in to change notification settings - Fork 97
Gcc6 fixes #62
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
Gcc6 fixes #62
Changes from all commits
c125d0b
118c19b
d19728d
3757272
17f5649
32dc016
2b077be
61b675f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,8 +120,6 @@ ErrorRegister::ErrorRegister( SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, | |
| ErrorRegisterType(), scr(r), scr_rc(SUCCESS), rMap(rm), | ||
| xNoErrorOnZeroScr(false), xScrId(scrId) | ||
| { | ||
| PRDF_ASSERT( &r != NULL ); | ||
| PRDF_ASSERT( &rm != NULL ); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand &r is ambiguous and not allowed anymore, however, I'd still like to have some sort of protection against something like this: Any suggestions?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hrm.... so dereferencing a null pointer is undefined behavior. From the standard: A reference shall be initialized to refer to a valid object or function. [ Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes undefined behavior. As described in 9.6, a reference cannot be bound directly to a bit-field. — end note ] So if there isn't a suitable check that |
||
|
|
||
| /*---------------------------------------------------------------------*/ | ||
|
|
||
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.
Surprised these changes were required, happen to remember what failed before you changed them?
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, without this patch I got (as the commit message for 99e4065 states): " error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]"
Which was due to alternately treating it as u32, u8[] and MBvpdVMKeyword. I didn't check the asm, but I would assume that the compiler is smart enough to effectively compile down the code to nothing.