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 c/29592] Unending loops



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-10-25 17:18 -------
(In reply to comment #5)
> Yeah, I know, but why gcc generate good code if we add that printf to test1.c
> (test2.c) ? It's still wchar * -> char * still aliasing violation.

Yes but there is a barrier which cause optimizations not to happen.
> 
> or if we replace:
> __SN(&str, 1); with
> str = (CHAR_T *) (((char *) str) + 1);
> 
> it generate good code too. it's still aliasing violation?

No, that is legal as you are not accessing str (wchar_t*) as a "char*" any
longer but as a "wchar_t*".  You access str as a "wchar_t*" and then cast that
value to a "char*" and then add one and then cast back to "wchar_t*" which
causes the above code to be valid and defined.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29592


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