This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/26679] New: boostrap failure due to warning in gcc/varasm.c
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Mar 2006 14:24:56 -0000
- Subject: [Bug bootstrap/26679] New: boostrap failure due to warning in gcc/varasm.c
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
During bootstrap line 3072 of varasm.c generates a warning that
shift >= width of type, and the build dies due to -Werror.
This diagnosis is correct but the shift is unreachable.
Environment:
System: Linux dps 2.6.15 #2 PREEMPT Sat Jan 7 17:47:27 GMT 2006 i686 GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr --enable-shared
--cache-file=config.cache
How-To-Repeat:
bootstrap with HOST_WIDE_INT intendical to unsinged int (e.g.
almost any 32 bit x86 box).
------- Comment #1 from dps at simpson dot demon dot co dot uk 2006-03-14 14:24 -------
Fix:
This patch uses reprocessor logic to elinminate the (harmless,
without -Werrror, warning.
--- gcc/varasm.c.dist 2006-03-08 11:53:25.000000000 +0000
+++ gcc/varasm.c 2006-03-14 14:12:15.000000000 +0000
@@ -3067,11 +3067,16 @@
int i;
h ^= (hashval_t) hwi;
+#if HOST_BITS_PER_WIDE_INT != SIZEOF_UNSIGNED_INT * CHAR_BIT
+ /* Leaving this in emits a warning, so stop compilation, if n=1 */
for (i = 1; i < n; ++i)
{
hwi >>= shift;
h ^= (hashval_t) hwi;
}
+#else
+ i=shift; i=n; /* Squash compiler warnings */
+#endif
}
break;
--- gcc/configure.ac.dist 2006-03-08 11:53:25.000000000 +0000
+++ gcc/configure.ac 2006-03-14 02:37:17.000000000 +0000
@@ -289,6 +289,7 @@
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(long)
AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)])
--- gcc/config.in.dist 2006-03-08 11:53:25.000000000 +0000
+++ gcc/config.in 2006-03-14 02:41:09.000000000 +0000
@@ -1240,6 +1240,11 @@
#undef SIZEOF_INT
#endif
+/* The size of a `usigned int` as computed by sizeof. */
+#ifndef USED_FOR_TARGET
+#undef SIZEOF_UNSIGNED_INT
+#endif
+
/* The size of a `long', as computed by sizeof. */
#ifndef USED_FOR_TARGET
--
Summary: boostrap failure due to warning in gcc/varasm.c
Product: gcc
Version: 2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dps at simpson dot demon dot co dot uk
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26679