This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Mainline won't bootstrap on Linux/alpha
- From: "H . J . Lu" <hjl at lucon dot org>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 May 2002 11:13:44 -0700
- Subject: Re: Mainline won't bootstrap on Linux/alpha
- References: <20020527091321.A3784@lucon.org> <jeadql4g9r.fsf@sykes.suse.de>
On Mon, May 27, 2002 at 08:06:24PM +0200, Andreas Schwab wrote:
> "H . J . Lu" <hjl@lucon.org> writes:
>
> |> Mainline went into an infinite in stage1 at
> |>
> |> stage1/xgcc -Bstage1/ -B/usr/gcc-3.1/alphaev56-unknown-linux-gnu/bin/ -c
> |> -DIN_GCC -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes
> |> -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H
> |> -DGENERATOR_FILE -I. -I. -I/home/hjl/work/gnu/src/gcc/gcc/gcc
> |> -I/home/hjl/work/gnu/src/gcc/gcc/gcc/.
> |> -I/home/hjl/work/gnu/src/gcc/gcc/gcc/config
> |> -I/home/hjl/work/gnu/src/gcc/gcc/gcc/../include
> |> /home/hjl/work/gnu/src/gcc/gcc/gcc/gengenrtl.c -o gengenrtl.o
>
> Same happens on ia64.
>
A simple testcase:
---
#include <stdio.h>
#include <sys/types.h>
main ()
{
unsigned long mask, low = 64;
size_t i, precision = 64;
i = precision - 1;
mask = 1 << i;
printf ("0x%x\n", mask);
printf ("0x%x\n", low);
for (; ; i--, mask >>= 1)
if (low & mask)
break;
printf ("0x%x\n", mask);
}
--
Here is a patch. You have to add L/UL for long int.
H.J.
----
2002-05-27 H.J. Lu (hjl@gnu.org)
* cppexp.c (num_trim): Use 1L instead of 1 for long int.
(num_positive): Likewise.
(num_div_op): Likewise.
--- gcc/cppexp.c.long Sun May 26 20:52:19 2002
+++ gcc/cppexp.c Mon May 27 11:06:48 2002
@@ -788,12 +788,12 @@ num_trim (num, precision)
{
precision -= PART_PRECISION;
if (precision < PART_PRECISION)
- num.high &= (1 << precision) - 1;
+ num.high &= (1L << precision) - 1;
}
else
{
if (precision < PART_PRECISION)
- num.low &= (1 << precision) - 1;
+ num.low &= (1L << precision) - 1;
num.high = 0;
}
@@ -809,10 +809,10 @@ num_positive (num, precision)
if (precision > PART_PRECISION)
{
precision -= PART_PRECISION;
- return (num.high & (1 << (precision - 1))) == 0;
+ return (num.high & (1L << (precision - 1))) == 0;
}
- return (num.low & (1 << (precision - 1))) == 0;
+ return (num.low & (1L << (precision - 1))) == 0;
}
/* Returns the negative of NUM. */
@@ -1246,7 +1246,7 @@ num_div_op (pfile, lhs, rhs, op)
if (rhs.high)
{
i = precision - 1;
- mask = 1 << (i - PART_PRECISION);
+ mask = 1L << (i - PART_PRECISION);
for (; ; i--, mask >>= 1)
if (rhs.high & mask)
break;
@@ -1257,7 +1257,7 @@ num_div_op (pfile, lhs, rhs, op)
i = precision - PART_PRECISION - 1;
else
i = precision - 1;
- mask = 1 << i;
+ mask = 1L << i;
for (; ; i--, mask >>= 1)
if (rhs.low & mask)
break;
@@ -1285,9 +1285,9 @@ num_div_op (pfile, lhs, rhs, op)
{
lhs = num_binary_op (pfile, lhs, sub, CPP_MINUS);
if (i >= PART_PRECISION)
- result.high |= 1 << (i - PART_PRECISION);
+ result.high |= 1L << (i - PART_PRECISION);
else
- result.low |= 1 << i;
+ result.low |= 1L << i;
}
if (i-- == 0)
break;