When compiling the following conditional: if (gerror) { printf ("%s%d: Error %s\n", __FILE__, __LINE__, gerror->message); std::auto_ptr<Glib::Error> e (Glib::Error::throw_exception (gerror)); printf ("If reached, code generation worked.\n"); } else { printf ("%s:%d: No error\n", __FILE__, __LINE__); }
the assembly code which would implement the second line of the "then" branch is absent, and there is no branch instruction which would cause control to jump past the "else" branch once the "then" branch finishes. The assembly code, starting shortly before the call to throw_exception(), emitted is: .LEHB4: call printf .loc 2 18 0 movl -24(%ebp), %eax leal -12(%ebp), %edx movl %eax, 4(%esp) movl %edx, (%esp) call _ZN4Glib5Error15throw_exceptionEP7_GError // // Code is missing here; .L18 below is the beginning of the // else branch // .L18: .LBE4: .loc 2 23 0 movl $23, 8(%esp) movl $.LC1, 4(%esp) movl $.LC3, (%esp) // .LC3 is the "%s:%d: No error\n" string literal call printf -- Summary: Broken code generation on if/else statement Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: matt dot hoosier at gmail dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30387