[Bug rtl-optimization/23567] New: [3.4/4.0 regression] if-conversion causes wrong code

belyshev at depni dot sinp dot msu dot ru gcc-bugzilla@gcc.gnu.org
Thu Aug 25 21:44:00 GMT 2005


This patch:

2003-11-02  Roger Sayle  <roger@eyesopen.com>

	PR optimization/10817
	* ifcvt.c (noce_emit_move_insn): Improve documentation comment.
	(noce_try_move): New function to optimize an if-the-else into an
	unconditional move, i.e. "if (a!=b) x=a; else x=b" into "x=a".
	(noce_process_if_block): Attempt simplification with noce_try_move.

causes wrong codegen for this testcase, (taken from debian bug #325050, see
bugs.debian.org/cgi-bin/bugreport.cgi?bug=325050 )

-----------------------------
struct
{
  int len;
  char *name;
} s;

int main (void)
{
  s.len = 0;
  s.name = "";
  if (s.name [s.len] != 0)
    s.name [s.len] = 0;
  return 0;
}
-----------------------------

This looks very similar to PR 13400.

-- 
           Summary: [3.4/4.0 regression] if-conversion causes wrong code
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: belyshev at depni dot sinp dot msu dot ru
                CC: gcc-bugs at gcc dot gnu dot org,sayle at gcc dot gnu dot
                    org


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



More information about the Gcc-bugs mailing list