public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/40946]  New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
@ 2009-08-03  8:27 jakub at gcc dot gnu dot org
  2009-08-08 22:58 ` [Bug middle-end/40946] " steven at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-03  8:27 UTC (permalink / raw)
  To: gcc-bugs

/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */

struct A
{
  unsigned char a1[8];
  unsigned short a2, a3, a4, a5, a6, a7;
};

int bar (void *, const char *, int);
char *foo (void *, int);

char *
baz (const char *x, const char *y)
{
  int a = sizeof (struct A) + 2 * (__builtin_strlen (y)
   + __builtin_strlen (x) + 24) + 16;
  struct A *b = __builtin_malloc (a);
  char *c;
  int d;

  b->a4 = sizeof (struct A);
  c = ((char *) b) + b->a4;
  d = ((char *) b) + a - c;
  b->a2 = b->a3 = (unsigned short) bar (c, y, d);/* { dg-bogus "array subscript
is above array bounds" } */
  c += b->a2;
  d = ((char *) b) + a - c;
  b->a7 = b->a4 + b->a2;
  b->a5 = b->a6 = (unsigned short) bar (c, x, d);
  c = foo (b, a);
  return c;
}

gives a spurious warning, because the cast of the struct to char pointer is
folded into array ref on the first field.


-- 
           Summary: [4.3/4.4/4.5 Regression] Spurious array subscript is
                    above bounds warning
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: powerpc-linux


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
@ 2009-08-08 22:58 ` steven at gcc dot gnu dot org
  2009-08-16 21:41 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-08-08 22:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-08 22:57:50
               date|                            |


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
  2009-08-08 22:58 ` [Bug middle-end/40946] " steven at gcc dot gnu dot org
@ 2009-08-16 21:41 ` rguenth at gcc dot gnu dot org
  2009-08-16 21:42 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-16 21:41 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
   Target Milestone|---                         |4.3.5


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
  2009-08-08 22:58 ` [Bug middle-end/40946] " steven at gcc dot gnu dot org
  2009-08-16 21:41 ` rguenth at gcc dot gnu dot org
@ 2009-08-16 21:42 ` rguenth at gcc dot gnu dot org
  2009-11-09 15:48 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-16 21:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-08-16 21:42 ` rguenth at gcc dot gnu dot org
@ 2009-11-09 15:48 ` jakub at gcc dot gnu dot org
  2009-11-09 15:51 ` rguenther at suse dot de
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-09 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-11-09 15:47 -------
This got fixed on the trunk with PR41317 and on the 4.4 branch also works well
with the backport of that patch (which I'm using for roughly a month on
redhat/gcc-4_4-branch because it cured some __builtin_object_size issues too).
I think we should just backport PR41317 patch to 4.4 branch and add this
testcase to trunk/4.4.  Richi, is that ok with you?


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-11-09 15:48 ` jakub at gcc dot gnu dot org
@ 2009-11-09 15:51 ` rguenther at suse dot de
  2009-11-09 19:39 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenther at suse dot de @ 2009-11-09 15:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenther at suse dot de  2009-11-09 15:51 -------
Subject: Re:  [4.3/4.4/4.5 Regression] Spurious array
 subscript is above bounds warning

On Mon, 9 Nov 2009, jakub at gcc dot gnu dot org wrote:

> ------- Comment #1 from jakub at gcc dot gnu dot org  2009-11-09 15:47 -------
> This got fixed on the trunk with PR41317 and on the 4.4 branch also works well
> with the backport of that patch (which I'm using for roughly a month on
> redhat/gcc-4_4-branch because it cured some __builtin_object_size issues too).
> I think we should just backport PR41317 patch to 4.4 branch and add this
> testcase to trunk/4.4.  Richi, is that ok with you?

Ok with me - it's a wrong-code fix anyway (I just didn't do it because
it might affect code generation quality in subtle ways without the
new oracle).  So I was waiting for a "real" testcase.

Richard.


-- 


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-11-09 15:51 ` rguenther at suse dot de
@ 2009-11-09 19:39 ` jakub at gcc dot gnu dot org
  2009-11-09 19:41 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-09 19:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-11-09 19:38 -------
Subject: Bug 40946

Author: jakub
Date: Mon Nov  9 19:38:29 2009
New Revision: 154046

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154046
Log:
        PR middle-end/40946
        Backport from mainline
        2009-09-09  Richard Guenther  <rguenther@suse.de>

        PR middle-end/41317
        * tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Remove
        code dealing with plain pointer bases.
        (maybe_fold_offset_to_reference): Likewise.
        (maybe_fold_stmt_addition): Adjust.

        PR middle-end/40946
        * gcc.dg/pr40946.c: New test.

        Backport from mainline
        2009-09-09  Richard Guenther  <rguenther@suse.de>

        PR middle-end/41317
        * gcc.c-torture/execute/pr41317.c: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr41317.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr40946.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/tree-ssa-ccp.c


-- 


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


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

* [Bug middle-end/40946] [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-11-09 19:39 ` jakub at gcc dot gnu dot org
@ 2009-11-09 19:41 ` jakub at gcc dot gnu dot org
  2009-11-09 19:44 ` [Bug middle-end/40946] [4.3 " jakub at gcc dot gnu dot org
  2010-05-22 18:33 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-09 19:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-11-09 19:41 -------
Subject: Bug 40946

Author: jakub
Date: Mon Nov  9 19:40:56 2009
New Revision: 154047

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154047
Log:
        PR middle-end/40946
        * gcc.dg/pr40946.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr40946.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/40946] [4.3 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-11-09 19:41 ` jakub at gcc dot gnu dot org
@ 2009-11-09 19:44 ` jakub at gcc dot gnu dot org
  2010-05-22 18:33 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-09 19:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-11-09 19:44 -------
Fixed on the trunk and 4.4 branch.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3/4.4/4.5 Regression]    |[4.3 Regression] Spurious
                   |Spurious array subscript is |array subscript is above
                   |above bounds warning        |bounds warning


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


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

* [Bug middle-end/40946] [4.3 Regression] Spurious array subscript is above bounds warning
  2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-11-09 19:44 ` [Bug middle-end/40946] [4.3 " jakub at gcc dot gnu dot org
@ 2010-05-22 18:33 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-05-22 18:13 -------
GCC 4.3.5 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.5                       |4.3.6


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


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

end of thread, other threads:[~2010-05-22 18:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-03  8:27 [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning jakub at gcc dot gnu dot org
2009-08-08 22:58 ` [Bug middle-end/40946] " steven at gcc dot gnu dot org
2009-08-16 21:41 ` rguenth at gcc dot gnu dot org
2009-08-16 21:42 ` rguenth at gcc dot gnu dot org
2009-11-09 15:48 ` jakub at gcc dot gnu dot org
2009-11-09 15:51 ` rguenther at suse dot de
2009-11-09 19:39 ` jakub at gcc dot gnu dot org
2009-11-09 19:41 ` jakub at gcc dot gnu dot org
2009-11-09 19:44 ` [Bug middle-end/40946] [4.3 " jakub at gcc dot gnu dot org
2010-05-22 18:33 ` rguenth 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).