public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
@ 2004-07-03  2:18 pinskia at gcc dot gnu dot org
  2004-07-03  2:19 ` [Bug bootstrap/16341] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03  2:18 UTC (permalink / raw)
  To: gcc-bugs

With BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure.
./combine.o differs
./df.o differs
./emit-rtl.o differs
./final.o differs
./loop.o differs
./recog.o differs
./tree-into-ssa.o differs
./varasm.o differs
cp/decl.o differs
java/parse-scan.o differs

Here is some of combine.o differences:
diff -up temp/combine.s temp1/combine.s
--- temp/combine.s      Fri Jul  2 19:14:06 2004
+++ temp1/combine.s     Fri Jul  2 19:13:32 2004
@@ -26569,42 +26569,43 @@ _combine_instructions:
        stmw r13,-76(r1)
        mfcr r12
        mflr r31
-       cmpwi cr4,r3,0
-       stw r0,8(r1)
        mr r10,r4
-       stw r12,4(r1)
+       stw r0,8(r1)
        li r0,0
+       stw r12,4(r1)
+       cmpwi cr4,r3,0
        addis r11,r31,ha16(_combine_rtl_hooks-"L00000000060$pb")
-       stwu r1,-144(r1)
+       addis r14,r31,ha16(L_rtl_hooks$non_lazy_ptr-"L00000000060$pb")
        la r2,lo16(_combine_rtl_hooks-"L00000000060$pb")(r11)
-       addis r7,r31,ha16(L_rtl_hooks$non_lazy_ptr-"L00000000060$pb")
-       lwz r9,lo16(L_rtl_hooks$non_lazy_ptr-"L00000000060$pb")(r7)
-       mr r30,r3
-       lwz r8,8(r2)
-       mr r3,r4
-       lwz r11,lo16(_combine_rtl_hooks-"L00000000060$pb")(r11)
+       stwu r1,-144(r1)
+       lwz r9,lo16(L_rtl_hooks$non_lazy_ptr-"L00000000060$pb")(r14)
        addis r16,r31,ha16(_combine_attempts-"L00000000060$pb")
-       stw r7,60(r1)
-       addis r14,r31,ha16(_combine_merges-"L00000000060$pb")
+       lwz r8,8(r2)
+       addis r13,r31,ha16(_combine_successes-"L00000000060$pb")
        lwz r7,4(r2)
-       addis r13,r31,ha16(_combine_extras-"L00000000060$pb")
-       addis r15,r31,ha16(_combine_successes-"L00000000060$pb")
+       addis r2,r31,ha16(_combine_extras-"L00000000060$pb")
+       lwz r11,lo16(_combine_rtl_hooks-"L00000000060$pb")(r11)
+       mr r30,r3
+       stw r2,60(r1)

The only reason why I was doing this is because I was trying out IMA (with a couple of patches to fix it 
from Zack and me) but it would fail so I decided to try with -O2 -fno-strict-aliasing and that failed too 
so I then tried -O2 -fno-strict-aliasing -fno-inline and that failed also, so I decided to see I could 
bootstrap with -O2 -fno-strict-aliasing -fno-inline on a clean build but that failed and I then went and 
found that -O2 -fno-inline made it failed.

-- 
           Summary: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a
                    comparision failure
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code, build
          Severity: critical
          Priority: P2
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
@ 2004-07-03  2:19 ` pinskia at gcc dot gnu dot org
  2004-07-03  2:49 ` pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03  2:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |powerpc-apple-darwin7.4.1
   Target Milestone|---                         |3.5.0


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
  2004-07-03  2:19 ` [Bug bootstrap/16341] " pinskia at gcc dot gnu dot org
@ 2004-07-03  2:49 ` pinskia at gcc dot gnu dot org
  2004-07-03  3:39 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03  2:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 02:49 -------
At least DOM is being miscompiled or something weird is going on:
from loop.c's .vars:
-  (T.6480 + regs->array)->set_in_loop = 0;
-  p.6567 = p.6252;
-  loop_depth.6251 = loop_depth.6570;
+  i = 0;
+
+<L467>:;
+  (regs->array + (struct loop_reg *)((unsigned int)(i + regno) * 16))->set_in_loop = 0;
+  i = i + 1;
+  if (i <= 0) goto <L467>; else goto <L1576>;
+
+<L1576>:;
+  p.6572 = p.6252;
+  loop_depth.6251 = loop_depth.6575;

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
  2004-07-03  2:19 ` [Bug bootstrap/16341] " pinskia at gcc dot gnu dot org
  2004-07-03  2:49 ` pinskia at gcc dot gnu dot org
@ 2004-07-03  3:39 ` pinskia at gcc dot gnu dot org
  2004-07-03 10:11 ` giovannibajo at libero dot it
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03  3:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 03:39 -------
It worked with an "22 Jun 2004 03:06:06 -0000" tree, a minute before Kenner's patch.

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-07-03  3:39 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 10:11 ` giovannibajo at libero dot it
  2004-07-03 18:58 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: giovannibajo at libero dot it @ 2004-07-03 10:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-07-03 10:11 -------
Confirmed. This is platform independent as I reproduced this on x86-linux. The 
set of failing files is slightly different (for a C-only bootstrap) but still:

./combine.o differs
./df.o differs
./dwarf2out.o differs
./expr.o differs
./final.o differs
./i386.o differs
./lcm.o differs
./loop.o differs
./recog.o differs
./tree-into-ssa.o differs


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
 GCC target triplet|powerpc-apple-darwin7.4.1   |
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-03 10:11:13
               date|                            |


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-07-03 10:11 ` giovannibajo at libero dot it
@ 2004-07-03 18:58 ` pinskia at gcc dot gnu dot org
  2004-07-03 19:27 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03 18:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 18:58 -------
It works also right after Kenner's patch: "22 Jun 2004 03:08:06 -0000".

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-07-03 18:58 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 19:27 ` pinskia at gcc dot gnu dot org
  2004-07-03 19:57 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03 19:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 19:27 -------
It fails at "30 Jun 2004 03:08:06 -0000".

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-07-03 19:27 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 19:57 ` pinskia at gcc dot gnu dot org
  2004-07-03 20:29 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03 19:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 19:57 -------
It works on "29 Jun 2004 16:24:28 -0000", right before RTH's rewrite of SRA.

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-07-03 19:57 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 20:29 ` pinskia at gcc dot gnu dot org
  2004-07-03 23:42   ` Graham Stott
  2004-07-03 23:43 ` graham dot stott at btinternet dot com
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03 20:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 20:29 -------
I fails on "29 Jun 2004 17:05:45 -0000"
The only two patches went in during the time frame is:
2004-06-29  Andrew Pinski  <apinski@apple.com>

        * tree-sra.c: Include expr.h for definition of MOVE_RATIO.
        * Makefile.in (tree-sra.c): Update dependencies.

2004-06-29  Richard Henderson  <rth@redhat.com>

        * tree-sra.c: Rewrite from scratch.  Handle nested aggregates.

My patch is only to get the build back up and building on powerpc-apple-darwin.

Richard can you look into this?

There is another bootstrap failure which is most likely related to this failure, it is a much harder to 
reproduce though, you build a full mainline and then you build the mainline again with the new 
compiler and it looks like it does not miscompiling of libcpp but I could be wrong.  It fails in stage2 
because __extension__ is missing from the preprocessed source.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03 20:29 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 23:42   ` Graham Stott
  2004-07-04  0:43     ` Graham Stott
  0 siblings, 1 reply; 19+ messages in thread
From: Graham Stott @ 2004-07-03 23:42 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

All,

It looks lile libcpp/expr.c:num_lshift is being miscompiled at least on i686-pc-linux-gnu

The following testcase shows the problem

extern void abort ();
extern int exit (int);

#define MAJOR   3
#define MINOR   5

#define PREREQ(maj, min) ((MAJOR << 16) + _MINOR >= ((maj) << 16) + (min))

int
main()
{
#if !PREREQ (2,8)
     abort ();
#else
     exit (0);
#endif
}

Cheers
Graham


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-07-03 20:29 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 23:43 ` graham dot stott at btinternet dot com
  2004-07-04  0:43 ` graham dot stott at btinternet dot com
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: graham dot stott at btinternet dot com @ 2004-07-03 23:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From graham dot stott at btinternet dot com  2004-07-03 23:42 -------
Subject: Re:  [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline'
 causes a comparision failure

All,

It looks lile libcpp/expr.c:num_lshift is being miscompiled at least on i686-pc-linux-gnu

The following testcase shows the problem

extern void abort ();
extern int exit (int);

#define MAJOR   3
#define MINOR   5

#define PREREQ(maj, min) ((MAJOR << 16) + _MINOR >= ((maj) << 16) + (min))

int
main()
{
#if !PREREQ (2,8)
     abort ();
#else
     exit (0);
#endif
}

Cheers
Graham


-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-07-03 23:43 ` graham dot stott at btinternet dot com
@ 2004-07-04  0:43 ` graham dot stott at btinternet dot com
  2004-07-04  1:08 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: graham dot stott at btinternet dot com @ 2004-07-04  0:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From graham dot stott at btinternet dot com  2004-07-04 00:43 -------
Subject: Re:  [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline'
 causes a comparision failure

All,

Here's a better testcase that extracted from libcpp/expr.c which fails on mainline target i686-pc-linux-gnu.

------------------------------------------------------------------------------------
#define PART_PRECISION (sizeof (cpp_num_part) * 8)

typedef unsigned int cpp_num_part;
typedef struct cpp_num cpp_num;
struct cpp_num
{
   cpp_num_part high;
   cpp_num_part low;
   int unsignedp;  /* True if value should be treated as unsigned.  */
   int overflow;   /* True if the most recent calculation overflowed.  */
};

static  int
num_positive (cpp_num num, unsigned int precision)
{
   if (precision > PART_PRECISION)
     {
       precision -= PART_PRECISION;
       return (num.high & (cpp_num_part) 1 << (precision - 1)) == 0;
     }

   return (num.low & (cpp_num_part) 1 << (precision - 1)) == 0;
}

static cpp_num
num_trim (cpp_num num, unsigned int precision)
{
   if (precision > PART_PRECISION)
     {
       precision -= PART_PRECISION;
       if (precision < PART_PRECISION)
         num.high &= ((cpp_num_part) 1 << precision) - 1;
     }
   else
     {
       if (precision < PART_PRECISION)
         num.low &= ((cpp_num_part) 1 << precision) - 1;
       num.high = 0;
     }

   return num;
}

/* Shift NUM, of width PRECISION, right by N bits.  */
static cpp_num
num_rshift (cpp_num num, unsigned int precision, unsigned int n)
{
   cpp_num_part sign_mask;
   int x = num_positive (num, precision);

   if (num.unsignedp || x)
     sign_mask = 0;
   else
     sign_mask = ~(cpp_num_part) 0;

   if (n >= precision)
     num.high = num.low = sign_mask;
   else
     {
       /* Sign-extend.  */
       if (precision < PART_PRECISION)
         num.high = sign_mask, num.low |= sign_mask << precision;
       else if (precision < 2 * PART_PRECISION)
         num.high |= sign_mask << (precision - PART_PRECISION);

       if (n >= PART_PRECISION)
         {
           n -= PART_PRECISION;
           num.low = num.high;
           num.high = sign_mask;
         }

       if (n)
         {
           num.low = (num.low >> n) | (num.high << (PART_PRECISION - n));
           num.high = (num.high >> n) | (sign_mask << (PART_PRECISION - n));
         }
     }

   num = num_trim (num, precision);
   num.overflow = 0;
   return num;
}
                              #define num_zerop(num) ((num.low | num.high) == 0)
#define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high)

cpp_num
num_lshift (cpp_num num, unsigned int precision, unsigned int n)
{
   if (n >= precision)
     {
       num.overflow = !num.unsignedp && !num_zerop (num);
       num.high = num.low = 0;
     }
   else
     {
       cpp_num orig;
       unsigned int m = n;

       orig = num;
       if (m >= PART_PRECISION)
         {
           m -= PART_PRECISION;
           num.high = num.low;
           num.low = 0;
         }
       if (m)
         {
           num.high = (num.high << m) | (num.low >> (PART_PRECISION - m));
           num.low <<= m;
         }
       num = num_trim (num, precision);

       if (num.unsignedp)
         num.overflow = 0;
       else
         {
           cpp_num maybe_orig = num_rshift (num, precision, n);
           num.overflow = !num_eq (orig, maybe_orig);
         }
     }

   return num;
}

unsigned int precision = 64;
unsigned int n = 16;

cpp_num num = { 0, 3, 0, 0 };

int main()
{
   cpp_num res = num_lshift (num, 64, n);

   if (res.low != 0x30000)
     abort ();

   if (res.high != 0)
     abort ();

   if (res.overflow != 0)
     abort ();

   exit (0);
}

------------------------------------------------------------------------------------------------







-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03 23:42   ` Graham Stott
@ 2004-07-04  0:43     ` Graham Stott
  0 siblings, 0 replies; 19+ messages in thread
From: Graham Stott @ 2004-07-04  0:43 UTC (permalink / raw)
  To: Graham Stott; +Cc: gcc-bugzilla, gcc-bugs

All,

Here's a better testcase that extracted from libcpp/expr.c which fails on mainline target i686-pc-linux-gnu.

------------------------------------------------------------------------------------
#define PART_PRECISION (sizeof (cpp_num_part) * 8)

typedef unsigned int cpp_num_part;
typedef struct cpp_num cpp_num;
struct cpp_num
{
   cpp_num_part high;
   cpp_num_part low;
   int unsignedp;  /* True if value should be treated as unsigned.  */
   int overflow;   /* True if the most recent calculation overflowed.  */
};

static  int
num_positive (cpp_num num, unsigned int precision)
{
   if (precision > PART_PRECISION)
     {
       precision -= PART_PRECISION;
       return (num.high & (cpp_num_part) 1 << (precision - 1)) == 0;
     }

   return (num.low & (cpp_num_part) 1 << (precision - 1)) == 0;
}

static cpp_num
num_trim (cpp_num num, unsigned int precision)
{
   if (precision > PART_PRECISION)
     {
       precision -= PART_PRECISION;
       if (precision < PART_PRECISION)
         num.high &= ((cpp_num_part) 1 << precision) - 1;
     }
   else
     {
       if (precision < PART_PRECISION)
         num.low &= ((cpp_num_part) 1 << precision) - 1;
       num.high = 0;
     }

   return num;
}

/* Shift NUM, of width PRECISION, right by N bits.  */
static cpp_num
num_rshift (cpp_num num, unsigned int precision, unsigned int n)
{
   cpp_num_part sign_mask;
   int x = num_positive (num, precision);

   if (num.unsignedp || x)
     sign_mask = 0;
   else
     sign_mask = ~(cpp_num_part) 0;

   if (n >= precision)
     num.high = num.low = sign_mask;
   else
     {
       /* Sign-extend.  */
       if (precision < PART_PRECISION)
         num.high = sign_mask, num.low |= sign_mask << precision;
       else if (precision < 2 * PART_PRECISION)
         num.high |= sign_mask << (precision - PART_PRECISION);

       if (n >= PART_PRECISION)
         {
           n -= PART_PRECISION;
           num.low = num.high;
           num.high = sign_mask;
         }

       if (n)
         {
           num.low = (num.low >> n) | (num.high << (PART_PRECISION - n));
           num.high = (num.high >> n) | (sign_mask << (PART_PRECISION - n));
         }
     }

   num = num_trim (num, precision);
   num.overflow = 0;
   return num;
}
                              #define num_zerop(num) ((num.low | num.high) == 0)
#define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high)

cpp_num
num_lshift (cpp_num num, unsigned int precision, unsigned int n)
{
   if (n >= precision)
     {
       num.overflow = !num.unsignedp && !num_zerop (num);
       num.high = num.low = 0;
     }
   else
     {
       cpp_num orig;
       unsigned int m = n;

       orig = num;
       if (m >= PART_PRECISION)
         {
           m -= PART_PRECISION;
           num.high = num.low;
           num.low = 0;
         }
       if (m)
         {
           num.high = (num.high << m) | (num.low >> (PART_PRECISION - m));
           num.low <<= m;
         }
       num = num_trim (num, precision);

       if (num.unsignedp)
         num.overflow = 0;
       else
         {
           cpp_num maybe_orig = num_rshift (num, precision, n);
           num.overflow = !num_eq (orig, maybe_orig);
         }
     }

   return num;
}

unsigned int precision = 64;
unsigned int n = 16;

cpp_num num = { 0, 3, 0, 0 };

int main()
{
   cpp_num res = num_lshift (num, 64, n);

   if (res.low != 0x30000)
     abort ();

   if (res.high != 0)
     abort ();

   if (res.overflow != 0)
     abort ();

   exit (0);
}

------------------------------------------------------------------------------------------------






^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-07-04  0:43 ` graham dot stott at btinternet dot com
@ 2004-07-04  1:08 ` pinskia at gcc dot gnu dot org
  2004-07-04  1:10 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-04  1:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-04 01:08 -------
hmm, the assignment is the wrong place:

-  # num$high_13 = PHI <num$high_3(7), num$high_195(8)>;
-  # num$low_6 = PHI <num$low_2(7), num$low_196(8)>;
 <L9>:;
-  num.high = num$high_13;
-  num.low = num$low_6;
-  num.unsignedp = num$unsignedp_138;
-  num.overflow = num$overflow_139;
-  num = num_trim (num, precision_15);
-  num$high_152 = num.high;
-  num$low_153 = num.low;
-  num$unsignedp_154 = num.unsignedp;
-  num$overflow_155 = num.overflow;
-  T.37_23 = num$unsignedp_154;
-  if (T.37_23 != 0) goto <L10>; else goto <L11>;
+  num = num_trim (num, precision_14);
+  num$overflow_144 = num.overflow;
+  num$high_145 = num.high;
+  num$low_146 = num.low;
+  num.overflow = num$overflow_144;
+  num.high = num$high_145;
+  num.low = num$low_146;
+  num.unsignedp = num$unsignedp_135;
+  num$unsignedp_151 = num.unsignedp;
+  T.37_22 = num$unsignedp_151;
+  if (T.37_22 != 0) goto <L10>; else goto <L11>;

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug bootstrap/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2004-07-04  1:08 ` pinskia at gcc dot gnu dot org
@ 2004-07-04  1:10 ` pinskia at gcc dot gnu dot org
  2004-07-04  2:51 ` [Bug tree-optimization/16341] " rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-04  1:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-04 01:10 -------
Note there are two different bootstrap failures here now, the one with libcpp being miscompiled which 
is what the last three (and a half) comments have been about.

And the one about -O2 -fno-inline but it looks like they are related and most likely the same one.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |graham dot stott at
                   |                            |btinternet dot com


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug tree-optimization/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2004-07-04  1:10 ` pinskia at gcc dot gnu dot org
@ 2004-07-04  2:51 ` rth at gcc dot gnu dot org
  2004-07-04  2:52 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-07-04  2:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-07-04 02:51 -------
Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
          Component|bootstrap                   |tree-optimization


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug tree-optimization/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2004-07-04  2:51 ` [Bug tree-optimization/16341] " rth at gcc dot gnu dot org
@ 2004-07-04  2:52 ` cvs-commit at gcc dot gnu dot org
  2004-07-04  2:54 ` rth at gcc dot gnu dot org
  2004-07-04 14:15 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-04  2:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-07-04 02:52 -------
Subject: Bug 16341

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-07-04 02:52:36

Modified files:
	gcc            : ChangeLog tree-sra.c 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20040703-1.c 

Log message:
	PR tree-optimization/16341
	* tree-sra.c (sra_walk_function): Increment to next stmt before
	processing the current stmt.
	(sra_insert_after): Always use BSI_SAME_STMT.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4277&r2=2.4278
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-sra.c.diff?cvsroot=gcc&r1=2.14&r2=2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040703-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug tree-optimization/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2004-07-04  2:52 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-04  2:54 ` rth at gcc dot gnu dot org
  2004-07-04 14:15 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 19+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-07-04  2:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-07-04 02:54 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug tree-optimization/16341] [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure
  2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2004-07-04  2:54 ` rth at gcc dot gnu dot org
@ 2004-07-04 14:15 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-04 14:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-04 14:15 -------
Just a note, there were the same bug, thanks RTH for fixing it.

-- 


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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2004-07-04 14:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-03  2:18 [Bug bootstrap/16341] New: [3.5 Regression] BOOT_CFLAGS='-O2 -fno-inline' causes a comparision failure pinskia at gcc dot gnu dot org
2004-07-03  2:19 ` [Bug bootstrap/16341] " pinskia at gcc dot gnu dot org
2004-07-03  2:49 ` pinskia at gcc dot gnu dot org
2004-07-03  3:39 ` pinskia at gcc dot gnu dot org
2004-07-03 10:11 ` giovannibajo at libero dot it
2004-07-03 18:58 ` pinskia at gcc dot gnu dot org
2004-07-03 19:27 ` pinskia at gcc dot gnu dot org
2004-07-03 19:57 ` pinskia at gcc dot gnu dot org
2004-07-03 20:29 ` pinskia at gcc dot gnu dot org
2004-07-03 23:42   ` Graham Stott
2004-07-04  0:43     ` Graham Stott
2004-07-03 23:43 ` graham dot stott at btinternet dot com
2004-07-04  0:43 ` graham dot stott at btinternet dot com
2004-07-04  1:08 ` pinskia at gcc dot gnu dot org
2004-07-04  1:10 ` pinskia at gcc dot gnu dot org
2004-07-04  2:51 ` [Bug tree-optimization/16341] " rth at gcc dot gnu dot org
2004-07-04  2:52 ` cvs-commit at gcc dot gnu dot org
2004-07-04  2:54 ` rth at gcc dot gnu dot org
2004-07-04 14:15 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).