This is the mail archive of the
mailing list for the GCC project.
[Bug c/29592] Unending loops
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2006 17:18:22 -0000
- Subject: [Bug c/29592] Unending loops
- References: <firstname.lastname@example.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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.