public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38699]  New: [4.2/4.3/4.4 regression] ICE using offsetof with array
@ 2009-01-02 14:41 reichelt at gcc dot gnu dot org
  2009-01-02 14:42 ` [Bug c++/38699] " reichelt at gcc dot gnu dot org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-01-02 14:41 UTC (permalink / raw)
  To: gcc-bugs

The following valid code snippet triggers an ICE since GCC 4.2.0:

======================================
struct A
{
  const char* p;
};

void foo()
{
  __builtin_offsetof(struct A, p[0]);
}
======================================

bug.cc: In function 'void foo()':
bug.cc:8: internal compiler error: in fold_offsetof_1, at c-common.c:7647
Please submit a full bug report, [etc.]

The code is accepted by the C frontend.


-- 
           Summary: [4.2/4.3/4.4 regression] ICE using offsetof with array
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with array
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
@ 2009-01-02 14:42 ` reichelt at gcc dot gnu dot org
  2009-01-02 15:21 ` jakub at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-01-02 14:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.5


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with array
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
  2009-01-02 14:42 ` [Bug c++/38699] " reichelt at gcc dot gnu dot org
@ 2009-01-02 15:21 ` jakub at gcc dot gnu dot org
  2009-01-02 20:09 ` pinskia at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-02 15:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-01-02 15:20 -------
That seems invalid, not valid.
E.g. C says that for offsetof (type, member) for
static type t;
&(t.member) evaluates to an address constant, which is not the case for
const char *p; field and p[0].


-- 


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with array
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
  2009-01-02 14:42 ` [Bug c++/38699] " reichelt at gcc dot gnu dot org
  2009-01-02 15:21 ` jakub at gcc dot gnu dot org
@ 2009-01-02 20:09 ` pinskia at gcc dot gnu dot org
  2009-01-02 22:27 ` pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-02 20:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-01-02 20:06 -------
Here is a testcase which ICEs with both the C and C++ front-end and is not
rejected by either of them:
struct A
{
  const char* p;
};

void foo()
{
  __builtin_offsetof(struct A, p[1]);
}
--- CUT ---
This is invalid code as p[1] is not a member of struct A, only p is a member.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|ice-on-valid-code           |ice-on-invalid-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-02 20:06:49
               date|                            |


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with array
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-01-02 20:09 ` pinskia at gcc dot gnu dot org
@ 2009-01-02 22:27 ` pinskia at gcc dot gnu dot org
  2009-01-03  0:14 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-02 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-01-02 22:24 -------
I have a patch at least for the C front-end, working on the C++ front-end now.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with array
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-01-02 22:27 ` pinskia at gcc dot gnu dot org
@ 2009-01-03  0:14 ` pinskia at gcc dot gnu dot org
  2009-01-03  6:00 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-03  0:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-01-03 00:12 -------
C is so much easier because templates.


-- 


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with array
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-01-03  0:14 ` pinskia at gcc dot gnu dot org
@ 2009-01-03  6:00 ` pinskia at gcc dot gnu dot org
  2009-01-03 15:32 ` [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with pointer and array accesses rguenth at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-03  6:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-01-03 05:59 -------
Ok, I have a simpler patch to just c-common.c to error out in this case.


-- 


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-01-03  6:00 ` pinskia at gcc dot gnu dot org
@ 2009-01-03 15:32 ` rguenth at gcc dot gnu dot org
  2009-02-04  7:53 ` bonzini at gnu dot org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-03 15:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.1.2
           Priority|P3                          |P2


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


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

* [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-01-03 15:32 ` [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with pointer and array accesses rguenth at gcc dot gnu dot org
@ 2009-02-04  7:53 ` bonzini at gnu dot org
  2009-03-31 21:06 ` [Bug c++/38699] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: bonzini at gnu dot org @ 2009-02-04  7:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from bonzini at gnu dot org  2009-02-04 07:53 -------
andrew, ping the patch :-)


-- 


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-02-04  7:53 ` bonzini at gnu dot org
@ 2009-03-31 21:06 ` jsm28 at gcc dot gnu dot org
  2009-08-04 12:46 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 21:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2009-03-31 21:06 -------
Closing 4.2 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.2/4.3/4.4/4.5 regression]|[4.3/4.4/4.5 regression] ICE
                   |ICE using offsetof with     |using offsetof with pointer
                   |pointer and array accesses  |and array accesses
   Target Milestone|4.2.5                       |4.3.4


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2009-03-31 21:06 ` [Bug c++/38699] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
@ 2009-08-04 12:46 ` rguenth at gcc dot gnu dot org
  2009-09-20 20:12 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-08-04 12:29 -------
GCC 4.3.4 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2009-08-04 12:46 ` rguenth at gcc dot gnu dot org
@ 2009-09-20 20:12 ` pinskia at gcc dot gnu dot org
  2009-10-28 15:42 ` dodji at redhat dot com
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-09-20 20:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2009-09-20 20:12 -------
I am no longer working on this patch ...


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2009-09-20 20:12 ` pinskia at gcc dot gnu dot org
@ 2009-10-28 15:42 ` dodji at redhat dot com
  2009-10-28 15:59 ` dodji at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dodji at redhat dot com @ 2009-10-28 15:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from dodji at gcc dot gnu dot org  2009-10-28 15:42 -------
Subject: Re:  [4.3/4.4/4.5 regression] ICE using offsetof
        with pointer and array accesses

I am testing the patch below.

I am not sure the approach is the right one though. Comments welcome.

diff --git a/gcc/c-common.c b/gcc/c-common.c
index 8a6d15b..54e551f 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -8341,6 +8341,32 @@ fold_offsetof_1 (tree expr, tree stop_ref)

     case NOP_EXPR:
     case INDIRECT_REF:
+      if (TREE_CODE (expr) == INDIRECT_REF)
+       {
+         tree r = TREE_OPERAND (expr, 0);
+
+         if ((TREE_CODE (r) == NON_LVALUE_EXPR
+              && TREE_CODE (TREE_TYPE (r)) == POINTER_TYPE)
+             ||
+             (TREE_CODE (r) == POINTER_PLUS_EXPR))
+           {
+             /* We are trying something like:
+                struct A
+                {
+                  char *p;
+                };
+                void f ()
+                {
+                  __builtin_offsetof(struct A, p[1]);
+                }
+                But the C spec says that if t is of type A, then
+                 &(t.p[1])" should evaluate to a constant address.
+                 And &(t.p[1]) does not evaluate to a constant address here.
+                */
+             error ("cannot apply %<offsetof%> to a non constant address");
+             return error_mark_node;
+           }
+       }
       base = fold_offsetof_1 (TREE_OPERAND (expr, 0), stop_ref);
       gcc_assert (base == error_mark_node || base == size_zero_node);
       return base;
@@ -8361,6 +8387,16 @@ fold_offsetof_1 (tree expr, tree stop_ref)
                            size_int (tree_low_cst (DECL_FIELD_BIT_OFFSET (t),
                                                    1)
                                      / BITS_PER_UNIT));
+      /* Check if we the offset goes beyond the bound of the struct.  */
+      if (int_cst_value (off)
+         >= (int_cst_value (TYPE_SIZE (TREE_TYPE (TREE_OPERAND (expr, 0))))
+             / BITS_PER_UNIT))
+       {
+         error_at (EXPR_LOCATION (t),
+                   "expression %qE denotes an offset greater than size of
%qT",
+                   t, TREE_TYPE (TREE_OPERAND (expr, 0)));
+         return error_mark_node;
+       }
       break;

     case ARRAY_REF:
@@ -8376,6 +8412,17 @@ fold_offsetof_1 (tree expr, tree stop_ref)
        }
       t = convert (sizetype, t);
       off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
+
+      /* Check if we the indice of the array goes beyond the bound.  */
+      if (int_cst_value (off)
+         >= (int_cst_value (TYPE_SIZE (TREE_TYPE (TREE_OPERAND (expr, 0))))
+             / BITS_PER_UNIT))
+       {
+         error_at (EXPR_LOCATION (expr),
+                   "indice %ld denotes an offset greater than size of %qT",
+                   int_cst_value (t), TREE_TYPE (TREE_OPERAND (expr, 0)));
+         return error_mark_node;
+       }
       break;

     case COMPOUND_EXPR:


-- 


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2009-10-28 15:42 ` dodji at redhat dot com
@ 2009-10-28 15:59 ` dodji at gcc dot gnu dot org
  2009-10-29 21:18 ` dodji at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-10-28 15:59 UTC (permalink / raw)
  To: gcc-bugs



-- 

dodji at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dodji at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-01-02 20:06:49         |2009-10-28 15:58:51
               date|                            |


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2009-10-28 15:59 ` dodji at gcc dot gnu dot org
@ 2009-10-29 21:18 ` dodji at gcc dot gnu dot org
  2009-11-03 10:45 ` dodji at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-10-29 21:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from dodji at gcc dot gnu dot org  2009-10-29 21:18 -------
Sent an updated patch to
http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01746.html


-- 


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2009-10-29 21:18 ` dodji at gcc dot gnu dot org
@ 2009-11-03 10:45 ` dodji at gcc dot gnu dot org
  2009-11-03 10:46 ` dodji at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-11-03 10:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from dodji at gcc dot gnu dot org  2009-11-03 10:44 -------
Subject: Bug 38699

Author: dodji
Date: Tue Nov  3 10:44:36 2009
New Revision: 153843

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153843
Log:
Fix PR c++/38699

gcc/ChangeLog:

        PR c++/38699
        * c-common.c (fold_offsetof_1): Issue errors when the
        member designator of the offsetoff expression is not legitimate.

gcc/testsuite/ChangeLog:

        * c-c++-common/dfp/builtin-offsetof.c: New test.
        * g++.dg/other/offsetof6.C: Likewise.

Added:
    trunk/gcc/testsuite/c-c++-common/dfp/builtin-offsetof.c
    trunk/gcc/testsuite/g++.dg/other/offsetof6.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2009-11-03 10:45 ` dodji at gcc dot gnu dot org
@ 2009-11-03 10:46 ` dodji at gcc dot gnu dot org
  2009-11-03 13:21 ` dodji at gcc dot gnu dot org
  2009-11-09 21:42 ` reichelt at gcc dot gnu dot org
  17 siblings, 0 replies; 19+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-11-03 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from dodji at gcc dot gnu dot org  2009-11-03 10:46 -------
Subject: Bug 38699

Author: dodji
Date: Tue Nov  3 10:46:00 2009
New Revision: 153844

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153844
Log:
Fix PR c++/38699

gcc/ChangeLog:

        PR c++/38699
        * c-common.c (fold_offsetof_1): Issue errors when the member designator
of
        the offsetoff expression is not legitimate.

gcc/testsuite/ChangeLog:

        * c-c++-common/dfp/builtin-offsetof.c: New test.
        * g++.dg/other/offsetof6.C: Likewise.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/c-c++-common/
    branches/gcc-4_4-branch/gcc/testsuite/c-c++-common/dfp/
    branches/gcc-4_4-branch/gcc/testsuite/c-c++-common/dfp/builtin-offsetof.c
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/offsetof6.C
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/c-common.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (15 preceding siblings ...)
  2009-11-03 10:46 ` dodji at gcc dot gnu dot org
@ 2009-11-03 13:21 ` dodji at gcc dot gnu dot org
  2009-11-09 21:42 ` reichelt at gcc dot gnu dot org
  17 siblings, 0 replies; 19+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-11-03 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from dodji at gcc dot gnu dot org  2009-11-03 13:20 -------
Subject: Bug 38699

Author: dodji
Date: Tue Nov  3 13:20:08 2009
New Revision: 153848

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153848
Log:
Move builtin-offsetof.c test

        PR c++/38699
        * c-c++-common/dfp/builtin-offsetof.c: Moved to ...
        * c-c++-common/builtin-offsetof.c: ... here.

Added:
    trunk/gcc/testsuite/c-c++-common/builtin-offsetof.c
      - copied, changed from r153846,
trunk/gcc/testsuite/c-c++-common/dfp/builtin-offsetof.c
Removed:
    trunk/gcc/testsuite/c-c++-common/dfp/builtin-offsetof.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/38699] [4.3/4.4/4.5 regression] ICE using offsetof with pointer and array accesses
  2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
                   ` (16 preceding siblings ...)
  2009-11-03 13:21 ` dodji at gcc dot gnu dot org
@ 2009-11-09 21:42 ` reichelt at gcc dot gnu dot org
  17 siblings, 0 replies; 19+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-11-09 21:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from reichelt at gcc dot gnu dot org  2009-11-09 21:42 -------
The bug is not a regression, because the code snippet is invalid and was never
correctly rejected since the introduction of __builtin_offsetof.
Since it's fixed now we can close it.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.3.5                       |4.4.3


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


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

end of thread, other threads:[~2009-11-09 21:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-02 14:41 [Bug c++/38699] New: [4.2/4.3/4.4 regression] ICE using offsetof with array reichelt at gcc dot gnu dot org
2009-01-02 14:42 ` [Bug c++/38699] " reichelt at gcc dot gnu dot org
2009-01-02 15:21 ` jakub at gcc dot gnu dot org
2009-01-02 20:09 ` pinskia at gcc dot gnu dot org
2009-01-02 22:27 ` pinskia at gcc dot gnu dot org
2009-01-03  0:14 ` pinskia at gcc dot gnu dot org
2009-01-03  6:00 ` pinskia at gcc dot gnu dot org
2009-01-03 15:32 ` [Bug c++/38699] [4.2/4.3/4.4 regression] ICE using offsetof with pointer and array accesses rguenth at gcc dot gnu dot org
2009-02-04  7:53 ` bonzini at gnu dot org
2009-03-31 21:06 ` [Bug c++/38699] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-08-04 12:46 ` rguenth at gcc dot gnu dot org
2009-09-20 20:12 ` pinskia at gcc dot gnu dot org
2009-10-28 15:42 ` dodji at redhat dot com
2009-10-28 15:59 ` dodji at gcc dot gnu dot org
2009-10-29 21:18 ` dodji at gcc dot gnu dot org
2009-11-03 10:45 ` dodji at gcc dot gnu dot org
2009-11-03 10:46 ` dodji at gcc dot gnu dot org
2009-11-03 13:21 ` dodji at gcc dot gnu dot org
2009-11-09 21:42 ` reichelt 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).