Bug 38999 - [4.6 Regression] Extra overflow warning in 32-bit HWI compiler
Summary: [4.6 Regression] Extra overflow warning in 32-bit HWI compiler
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P2 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on: 38934
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-28 11:19 UTC by Jakub Jelinek
Modified: 2013-04-12 16:17 UTC (History)
9 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu (HWI == 32bits only)
Build:
Known to work: 3.2
Known to fail: 3.3, 3.4.0, 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0
Last reconfirmed: 2009-02-21 22:25:37


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2009-01-28 11:19:35 UTC
+++ This bug was initially created as a clone of Bug #38934 +++

This failure is not "worked around" by FRE unlike 38932.

/* { dg-do compile } */
/* { dg-options "-O2 --std=gnu99" } */

/* This variable needed only to work around earlier optimizations than VRP.  */
unsigned char g;

extern void abort();

void f (long long int p)
{
  g = 255;
  /* { dg-warning "constant is" "" { target *-*-* } 14 } */
  /* { dg-warning "overflow" "" { target *-*-* } 14 } */
  if (p >= -9223372036854775808LL - (signed char) g)
    p = 1;

  if (p)
    abort ();
}

3.2.x issued just one warning both in 32-bit HWI i386 gcc and x86_64 -m32 gcc,
haven't checked 3.3, 3.4 and later issues one extra warning in 32-bit HWI compilation.
Comment 1 Paolo Bonzini 2009-01-28 11:27:54 UTC
Two warnings for 3.3.
Comment 2 Steven Bosscher 2009-02-21 22:25:37 UTC
Confirmed, then...  I've tested 3.4, 4.1, and 4.3.  I suppose 4.2 is the same.
Comment 3 Joseph S. Myers 2009-03-31 21:08:17 UTC
Closing 4.2 branch.
Comment 4 Richard Biener 2009-08-04 12:29:49 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 5 Richard Biener 2010-05-22 18:13:19 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 6 Richard Biener 2011-06-27 12:13:53 UTC
4.3 branch is being closed, moving to 4.4.7 target.
Comment 7 Richard Biener 2012-01-16 13:22:28 UTC
Since 4.7 we have need_64bit_hwint=yes for the target the bug was reported against.

But I'm confused.  Do we want two warnings here?

3.3.6 and 3.4.6 say:

/space/rguenther/install/gcc-3.3.6/bin/gcc -S -std=c99 t.c
t.c:10:13: warning: integer constant is so large that it is unsigned
t.c: In function `f':
t.c:10: warning: integer overflow in expression

while since 4.0.0 we say

t.c:10:13: warning: integer constant is so large that it is unsigned

I don't think we anywhere have a 'integer overflow in expression' warning
(not by default at least) that triggers during optimization.

So - is 4.7 fixed (because hwint 64 is default)?  I didn't really check
hwint32 builds of 4.x.
Comment 8 Jakub Jelinek 2012-01-16 13:29:56 UTC
I guess we can close this for 4.7+ where we have always 64-bit HWINTs on i686.
Comment 9 Jakub Jelinek 2012-03-13 12:46:57 UTC
4.4 branch is being closed, moving to 4.5.4 target.
Comment 10 Richard Biener 2012-07-02 11:01:33 UTC
The 4.5 branch is being closed, adjusting target milestone.
Comment 11 Jakub Jelinek 2013-04-12 16:17:29 UTC
The 4.6 branch has been closed, fixed in GCC 4.7.0.