This is the mail archive of the gcc-patches@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]

PATCH: incorrect cost calculation in estimate_num_insns_1


I stumbled on a bug in estimate_num_insns_1 where it modifies a
pointer with

  *count++;

where the code (and comment) indicates that

  *count += 1;

was intended.


Changing this (as in the patch below) fix one libstdc++ test-suite ICE
for i386-unknown-netbsdelf1.6:

  FAIL: ext/rope/2.cc (test for excess errors)
  WARNING: ext/rope/2.cc compilation failed to produce executable

but it does also introduce one new libstdc++ ICE:

  FAIL: 23_containers/map/invalidation/2.cc (test for excess errors)
  WARNING: 23_containers/map/invalidation/2.cc compilation failed to produce executable

I do however think that this is not really due to the patch, since
these tests are in a class of tests that give me different set of
failures depending on where in the file system i do the bootstrap...
So I would guess there is a fun memory corruption somewhere...


But I guess this must be tested by someone with a more repeatable
target before committing...

   /Krister


2004-07-16  Krister Walfridsson  <cato@df.lth.se>

	* tree-inline.c (estimate_num_insns_1): Correct increase of count.


Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.126
diff -c -3 -p -r1.126 tree-inline.c
*** tree-inline.c	7 Jul 2004 22:03:41 -0000	1.126
--- tree-inline.c	15 Jul 2004 22:34:40 -0000
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 1319,1325 ****
      case ASM_EXPR:

      case RESX_EXPR:
!       *count++;
        break;

      /* Few special cases of expensive operations.  This is useful
--- 1319,1325 ----
      case ASM_EXPR:

      case RESX_EXPR:
!       *count += 1;
        break;

      /* Few special cases of expensive operations.  This is useful


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