public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36432]  New: “incompatible pointer type” with pointer to array as a struct member
@ 2008-06-04  2:57 anders at kaseorg dot com
  2008-06-04 10:46 ` [Bug c/36432] " jsm28 at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anders at kaseorg dot com @ 2008-06-04  2:57 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

According to gcc warnings, a pointer to int[] can be assigned the address of an
int[3], but not if the variable is a struct member:

int main() {
    int array[3];
    int (*ptr)[];
    struct { int (*ptr)[]; } st;

    ptr = &array;     // fine
    st.ptr = &array;  // warning: assignment from incompatible pointer type
}


-- 
           Summary: “incompatible pointer type” with pointer to array as a
                    struct member
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anders at kaseorg dot com


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


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

* [Bug c/36432] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
@ 2008-06-04 10:46 ` jsm28 at gcc dot gnu dot org
  2009-02-06 15:35 ` [Bug c/36432] [4.2/4.3/4.4 Regression] " jsm28 at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-06-04 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jsm28 at gcc dot gnu dot org  2008-06-04 10:46 -------
GCC is wrongly treating any [] in a field declarator as meaning a flexible
array member, instead of only those declaring the field itself as an array.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16620, 16989
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-06-04 10:46:01
               date|                            |


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


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

* [Bug c/36432] [4.2/4.3/4.4 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
  2008-06-04 10:46 ` [Bug c/36432] " jsm28 at gcc dot gnu dot org
@ 2009-02-06 15:35 ` jsm28 at gcc dot gnu dot org
  2009-02-06 20:12 ` jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-02-06 15:35 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]



------- Comment #2 from jsm28 at gcc dot gnu dot org  2009-02-06 15:35 -------
This is actually a regression relative to GCC versions not supporting flexible
array members (2.95 and before).  Testing a patch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jsm28 at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-06-04 10:46:01         |2009-02-06 15:35:13
               date|                            |
            Summary|“incompatible pointer type” |[4.2/4.3/4.4 Regression]
                   |with pointer to array as a  |“incompatible pointer type”
                   |struct member               |with pointer to array as a
                   |                            |struct member
   Target Milestone|---                         |4.2.5


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


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

* [Bug c/36432] [4.2/4.3/4.4 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
  2008-06-04 10:46 ` [Bug c/36432] " jsm28 at gcc dot gnu dot org
  2009-02-06 15:35 ` [Bug c/36432] [4.2/4.3/4.4 Regression] " jsm28 at gcc dot gnu dot org
@ 2009-02-06 20:12 ` jsm28 at gcc dot gnu dot org
  2009-02-06 20:42 ` [Bug c/36432] [4.2/4.3 " jsm28 at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-02-06 20:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jsm28 at gcc dot gnu dot org  2009-02-06 20:12 -------
Subject: Bug 36432

Author: jsm28
Date: Fri Feb  6 20:12:10 2009
New Revision: 143989

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143989
Log:
        PR c/36432
        * c-decl.c (grokdeclarator): Don't treat [] declarators in fields
        as indicating flexible array members unless the field itself is
        being declarared as the incomplete array.

testsuite:
        * gcc.dg/c90-flex-array-2.c, gcc.dg/c99-flex-array-6.c: New tests.

Added:
    trunk/gcc/testsuite/gcc.dg/c90-flex-array-2.c
    trunk/gcc/testsuite/gcc.dg/c99-flex-array-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/36432] [4.2/4.3 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
                   ` (2 preceding siblings ...)
  2009-02-06 20:12 ` jsm28 at gcc dot gnu dot org
@ 2009-02-06 20:42 ` jsm28 at gcc dot gnu dot org
  2009-02-08 19:02 ` jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-02-06 20:42 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 740 bytes --]



------- Comment #4 from jsm28 at gcc dot gnu dot org  2009-02-06 20:42 -------
Fixed for 4.4 so far.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.3.3 4.4.0 4.3.0           |3.3.3 4.3.0
      Known to work|                            |4.4.0
            Summary|[4.2/4.3/4.4 Regression]    |[4.2/4.3 Regression]
                   |“incompatible pointer type” |“incompatible pointer type”
                   |with pointer to array as a  |with pointer to array as a
                   |struct member               |struct member


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


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

* [Bug c/36432] [4.2/4.3 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
                   ` (3 preceding siblings ...)
  2009-02-06 20:42 ` [Bug c/36432] [4.2/4.3 " jsm28 at gcc dot gnu dot org
@ 2009-02-08 19:02 ` jsm28 at gcc dot gnu dot org
  2009-02-08 19:05 ` [Bug c/36432] [4.2 " jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-02-08 19:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2009-02-08 19:02 -------
Subject: Bug 36432

Author: jsm28
Date: Sun Feb  8 19:01:57 2009
New Revision: 144018

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144018
Log:
        PR c/36432
        * c-decl.c (grokdeclarator): Don't treat [] declarators in fields
        as indicating flexible array members unless the field itself is
        being declarared as the incomplete array.

testsuite:
        * gcc.dg/c90-flex-array-2.c, gcc.dg/c99-flex-array-6.c: New tests.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/c90-flex-array-2.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/c99-flex-array-6.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-decl.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/36432] [4.2 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
                   ` (4 preceding siblings ...)
  2009-02-08 19:02 ` jsm28 at gcc dot gnu dot org
@ 2009-02-08 19:05 ` jsm28 at gcc dot gnu dot org
  2009-03-31 15:40 ` jsm28 at gcc dot gnu dot org
  2009-07-30 11:27 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-02-08 19:05 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]



------- Comment #6 from jsm28 at gcc dot gnu dot org  2009-02-08 19:05 -------
Fixed for 4.3.4 and 4.4.0.  Not planning to work on a backport to 4.2.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jsm28 at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
      Known to fail|3.3.3 4.3.0                 |3.3.3 4.3.0 4.3.3
      Known to work|4.4.0                       |4.3.4 4.4.0
            Summary|[4.2/4.3 Regression]        |[4.2 Regression]
                   |“incompatible pointer type” |“incompatible pointer type”
                   |with pointer to array as a  |with pointer to array as a
                   |struct member               |struct member


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


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

* [Bug c/36432] [4.2 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
                   ` (5 preceding siblings ...)
  2009-02-08 19:05 ` [Bug c/36432] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-31 15:40 ` jsm28 at gcc dot gnu dot org
  2009-07-30 11:27 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 15:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2009-03-31 15:40 -------
Closing 4.2 branch, fixed for 4.3.4 and 4.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|3.3.3 4.3.0 4.3.3           |3.3.3 4.3.0 4.3.3 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.4


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


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

* [Bug c/36432] [4.2 Regression] “incompatible pointer type” with pointer to array as a struct member
  2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
                   ` (6 preceding siblings ...)
  2009-03-31 15:40 ` jsm28 at gcc dot gnu dot org
@ 2009-07-30 11:27 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-07-30 11:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2009-07-30 11:27 -------
*** Bug 40911 has been marked as a duplicate of this bug. ***


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |olivier dot lobry at free
                   |                            |dot fr


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


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

end of thread, other threads:[~2009-07-30 11:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-04  2:57 [Bug c/36432] New: “incompatible pointer type” with pointer to array as a struct member anders at kaseorg dot com
2008-06-04 10:46 ` [Bug c/36432] " jsm28 at gcc dot gnu dot org
2009-02-06 15:35 ` [Bug c/36432] [4.2/4.3/4.4 Regression] " jsm28 at gcc dot gnu dot org
2009-02-06 20:12 ` jsm28 at gcc dot gnu dot org
2009-02-06 20:42 ` [Bug c/36432] [4.2/4.3 " jsm28 at gcc dot gnu dot org
2009-02-08 19:02 ` jsm28 at gcc dot gnu dot org
2009-02-08 19:05 ` [Bug c/36432] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-31 15:40 ` jsm28 at gcc dot gnu dot org
2009-07-30 11:27 ` jsm28 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).