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++/46096] Code produces two different outputs when optimized respectively with -O2 and without it.


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-10-20 14:27:18 UTC ---
The field is not volatile, so in the loop nothing forces ->number field to be
loaded from memory again.
So it is perfectly fine to optize the whole loop into:
if (alpha1->number!=4)
  for (;;); /* Endless loop.  */


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