This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ipa/66424] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424

--- Comment #4 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to joseph@codesourcery.com from comment #3)
> See C11 6.5.2.2#6 regarding when calls to unprototyped functions involve 
> undefined behavior.  Being able to represent the value is only relevant 
> where the case is a mismatch of corresponding signed/unsigned types.

Joseph, thank you for the clarification. I assume that you were referring to
the following passage of C11 6.5.2.2 #6: 

"If the function is defined with a type that does not include a prototype, and
the types of the arguments after promotion are not compatible with those of the
parameters after promotion, the behavior is undefined, except for the following
cases ... "

Since int and long long are incompatible, thus the test case's behavior is
undefined. Correct? 

If I may ask a follow-up question: How GCC treats the test case seems to have
changed from 4.9 to 5.1. What might have prompted the change as the 4.9
behavior to me seems more natural and user-friendly (and is also how clang
behaves)?  

Thank you.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]