public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof
@ 2005-03-17 14:38 rth at gcc dot gnu dot org
  2005-03-17 14:52 ` [Bug c/20519] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-03-17 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

const char foo[] = "libc";
extern __typeof (foo) bar __attribute__((alias ("foo")));
int s1 = sizeof foo;
int s2 = sizeof bar;

yields

z.c:4: error: invalid application of ‘sizeof’ to incomplete type ‘const char[]’

with 4.0 and HEAD.  Compiles successfully with 3.2.3 and 3.4.4.  Also compiles
successfully with 4.0 and HEAD with -Dconst=''.  That is, the failure goes away
if we remove const from the picture.

-- 
           Summary: [4.0/4.1 regression] completed type not selected
                    properly with typeof
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,roland at redhat dot com


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
@ 2005-03-17 14:52 ` pinskia at gcc dot gnu dot org
  2005-03-17 14:56 ` rth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-17 14:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-17 14:49 -------
Confirmed.  This started to happen after 2004-12-11 but before 20050225.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-17 14:49:20
               date|                            |
   Target Milestone|---                         |4.0.0


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
  2005-03-17 14:52 ` [Bug c/20519] " pinskia at gcc dot gnu dot org
@ 2005-03-17 14:56 ` rth at gcc dot gnu dot org
  2005-03-17 16:14 ` rth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-03-17 14:56 UTC (permalink / raw)
  To: gcc-bugs

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


------- Additional Comments From rth at gcc dot gnu dot org  2005-03-17 14:53 -------
Smaller test case with 

const char foo[] = "libc";
__typeof (foo) bar;

though this gives a different diagnostic:

z.c:2: warning: array ‘bar’ assumed to have one element


-- 


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
  2005-03-17 14:52 ` [Bug c/20519] " pinskia at gcc dot gnu dot org
  2005-03-17 14:56 ` rth at gcc dot gnu dot org
@ 2005-03-17 16:14 ` rth at gcc dot gnu dot org
  2005-03-17 16:20 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-03-17 16:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-03-17 16:14 -------
Array dimension data gets stripped here:

c-decl.c:grokdeclarator
3863      if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
3864        type = TYPE_MAIN_VARIANT (type);


-- 


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-03-17 16:14 ` rth at gcc dot gnu dot org
@ 2005-03-17 16:20 ` pinskia at gcc dot gnu dot org
  2005-03-17 16:25 ` joseph at codesourcery dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-17 16:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-17 16:20 -------
I think this was caused by:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg02180.html

-- 


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-03-17 16:20 ` pinskia at gcc dot gnu dot org
@ 2005-03-17 16:25 ` joseph at codesourcery dot com
  2005-03-17 22:03 ` rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: joseph at codesourcery dot com @ 2005-03-17 16:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joseph at codesourcery dot com  2005-03-17 16:25 -------
Subject: Re:  [4.0/4.1 regression] completed type not selected
 properly with typeof

On Thu, 17 Mar 2005, rth at gcc dot gnu dot org wrote:

> Array dimension data gets stripped here:
> 
> c-decl.c:grokdeclarator
> 3863      if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
> 3864        type = TYPE_MAIN_VARIANT (type);

Looks like complete_array_type is broken in that it should complete the 
unqualified type then build the array of qualified type with the proper 
TYPE_MAIN_VARIANT.  Because my audit was auditing all uses of 
build_array_type and TYPE_MAIN_VARIANT and complete_array_type is 
modifying types directly, this didn't get caught.



-- 


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-03-17 16:25 ` joseph at codesourcery dot com
@ 2005-03-17 22:03 ` rth at gcc dot gnu dot org
  2005-03-30  1:35 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-03-17 22:03 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-03-17 14:49:20         |2005-03-17 22:03:41
               date|                            |


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-03-17 22:03 ` rth at gcc dot gnu dot org
@ 2005-03-30  1:35 ` cvs-commit at gcc dot gnu dot org
  2005-03-30  1:38 ` cvs-commit at gcc dot gnu dot org
  2005-03-30  1:46 ` rth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-30  1:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-30 01:35 -------
Subject: Bug 20519

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2005-03-30 01:35:16

Modified files:
	gcc            : ChangeLog c-common.c c-common.h c-decl.c 
	                 c-tree.h 
	gcc/cp         : ChangeLog cp-tree.h decl.c semantics.c 
	                 typeck2.c 

Log message:
	PR c/20519
	* c-decl.c (c_finish_incomplete_decl): Update complete_array_type call.
	(build_compound_literal): Likewise.  Propagate decl type into the
	initializer.
	(finish_decl): Likewise.  Use new return value from complete_array_type
	for zero sized arrays.
	(complete_array_type): Move ...
	* c-common.c (complete_array_type): ... here.  Change first argument
	to pointer-to-type-node.  Consistently use sizetype for the index
	except for zero sized arrays.  Detect zero sized arrays for pedantic
	mode diagnostics.  Create a new type node instead of modifying the
	old node in place.
	* c-tree.h (complete_array_type): Move decl ...
	* c-common.h (complete_array_type): ... here.
	cp/
	* decl.c (cp_complete_array_type): Rename from complete_array_type.
	Use the new complete_array_type in c-common.c.  Update all callers.
	* cp-tree.h (cp_complete_array_type): Update to match.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8020&r2=2.8021
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.617&r2=1.618
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.279&r2=1.280
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.640&r2=1.641
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&r1=1.197&r2=1.198
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4678&r2=1.4679
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1113&r2=1.1114
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1381&r2=1.1382
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.465&r2=1.466
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck2.c.diff?cvsroot=gcc&r1=1.182&r2=1.183



-- 


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-03-30  1:35 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-30  1:38 ` cvs-commit at gcc dot gnu dot org
  2005-03-30  1:46 ` rth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-30  1:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-30 01:38 -------
Subject: Bug 20519

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	rth@gcc.gnu.org	2005-03-30 01:38:22

Modified files:
	gcc            : ChangeLog c-common.c c-common.h c-decl.c 
	                 c-tree.h 
	gcc/cp         : ChangeLog cp-tree.h decl.c semantics.c 
	                 typeck2.c 

Log message:
	PR c/20519
	* c-decl.c (c_finish_incomplete_decl): Update complete_array_type call.
	(build_compound_literal): Likewise.  Propagate decl type into the
	initializer.
	(finish_decl): Likewise.  Use new return value from complete_array_type
	for zero sized arrays.
	(complete_array_type): Move ...
	* c-common.c (complete_array_type): ... here.  Change first argument
	to pointer-to-type-node.  Consistently use sizetype for the index
	except for zero sized arrays.  Detect zero sized arrays for pedantic
	mode diagnostics.  Create a new type node instead of modifying the
	old node in place.
	* c-tree.h (complete_array_type): Move decl ...
	* c-common.h (complete_array_type): ... here.
	cp/
	* decl.c (cp_complete_array_type): Rename from complete_array_type.
	Use the new complete_array_type in c-common.c.  Update all callers.
	* cp-tree.h (cp_complete_array_type): Update to match.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.90&r2=2.7592.2.91
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.606.2.1&r2=1.606.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.277&r2=1.277.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.630.6.1&r2=1.630.6.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.193&r2=1.193.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.19&r2=1.4648.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1106.2.1&r2=1.1106.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1371.2.5&r2=1.1371.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.463.2.1&r2=1.463.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.182&r2=1.182.8.1



-- 


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


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

* [Bug c/20519] [4.0/4.1 regression] completed type not selected properly with typeof
  2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-03-30  1:38 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-30  1:46 ` rth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-03-30  1:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-03-30 01:46 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2005-03-30  1:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 14:38 [Bug c/20519] New: [4.0/4.1 regression] completed type not selected properly with typeof rth at gcc dot gnu dot org
2005-03-17 14:52 ` [Bug c/20519] " pinskia at gcc dot gnu dot org
2005-03-17 14:56 ` rth at gcc dot gnu dot org
2005-03-17 16:14 ` rth at gcc dot gnu dot org
2005-03-17 16:20 ` pinskia at gcc dot gnu dot org
2005-03-17 16:25 ` joseph at codesourcery dot com
2005-03-17 22:03 ` rth at gcc dot gnu dot org
2005-03-30  1:35 ` cvs-commit at gcc dot gnu dot org
2005-03-30  1:38 ` cvs-commit at gcc dot gnu dot org
2005-03-30  1:46 ` rth 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).