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++/40389] New: optimizer bug (possibly)


After compiling a particular C++ program (see attachment) both with and without
the -O option, the program produces different results.

When compiled with -O, the program produces the output "(nil)", whereas when
compiled without any options, the program prints a non-null pointer (which may
of course vary between runs).

The program is only 121 lines long, and was obtained by reducing an initial set
of over 30.000 lines of code until no further reduction seemed to be possible
without suppressing the problem. For example, by moving the static variable "
fs_active_handle" into the main function, the problem "magically" disappears.
Also, when adding printf-statements to the functions, or by manually inlining
certain constructs, the problem disappears.

Due to the immense reduction of the code, the semantics of the code may not
seem clear anymore (that is, I am myself not sure what this program is supposed
to do anymore), but the problem with the optimizer clearly shows.

I have tried to use the tool valgrind to see if something illegal is happening
wrt copy-constructors/assignment operators (despite close inspection), but this
does not seem to be the case.


-- 
           Summary: optimizer bug (possibly)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: keesjan at cobalt dot et dot tudelft dot nl
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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