public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66068] New: error: type variant has different TYPE_VFIELD
@ 2015-05-08  7:41 dcb314 at hotmail dot com
  2015-05-11 14:56 ` [Bug debug/66068] [6 Regression] " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2015-05-08  7:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

            Bug ID: 66068
           Summary: error: type variant has different TYPE_VFIELD
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 35495
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35495&action=edit
C source code

The attached code, when compiled by gcc trunk dated 20150506
and with flag -g, says this:

udns_resolver.c: In function ‘dns_new’:
udns_resolver.c:474:1: error: type variant has different TYPE_VFIELD

...

udns_resolver.c:474:1: internal compiler error: verify_type failed
0xe3782b verify_type(tree_node const*)
    ../../src/trunk/gcc/tree.c:12695
0x7de490 gen_type_die_with_usage
    ../../src/trunk/gcc/dwarf2out.c:20247
0x7cede2 gen_type_die_with_usage
    ../../src/trunk/gcc/dwarf2out.c:20334
0x7cd756 gen_type_die
    ../../src/trunk/gcc/dwarf2out.c:20431
>From gcc-bugs-return-485826-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 08 07:45:49 2015
Return-Path: <gcc-bugs-return-485826-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 122982 invoked by alias); 8 May 2015 07:45:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 122935 invoked by uid 48); 8 May 2015 07:45:43 -0000
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/66066] [6 Regression] r222889 causes bogus error: initializer element is not constant
Date: Fri, 08 May 2015 07:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: trippels at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66066-4-Tph0O7ef0E@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66066-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66066-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-05/txt/msg00666.txt.bz2
Content-length: 454

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf066

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #1)
> Yes, that is expected (in C99!).  See
> <https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01946.html>.  New tests
> c90-left-shift-1.c and c99-left-shift-1.c explicitly test such behavior.

Hmm, that looks quite unfortunate from a qoi standpoint.
It will break tons of existing code.


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
@ 2015-05-11 14:56 ` mpolacek at gcc dot gnu.org
  2015-05-11 14:56 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-11 14:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
          Component|c                           |debug
   Target Milestone|---                         |6.0
            Summary|error: type variant has     |[6 Regression] error: type
                   |different TYPE_VFIELD       |variant has different
                   |                            |TYPE_VFIELD

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Reduced:

struct S a;
const struct S b;
struct S
{
};


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
  2015-05-11 14:56 ` [Bug debug/66068] [6 Regression] " mpolacek at gcc dot gnu.org
@ 2015-05-11 14:56 ` mpolacek at gcc dot gnu.org
  2015-05-11 15:02 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-11 14:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-05-11
     Ever confirmed|0                           |1


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
  2015-05-11 14:56 ` [Bug debug/66068] [6 Regression] " mpolacek at gcc dot gnu.org
  2015-05-11 14:56 ` mpolacek at gcc dot gnu.org
@ 2015-05-11 15:02 ` mpolacek at gcc dot gnu.org
  2015-06-16  5:22 ` trippels at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-11 15:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another testcase:

union U a;
const union U b;
union U
{
};


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2015-05-11 15:02 ` mpolacek at gcc dot gnu.org
@ 2015-06-16  5:22 ` trippels at gcc dot gnu.org
  2015-08-13 20:21 ` matt at use dot net
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-06-16  5:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ienkovich at gcc dot gnu.org

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
*** Bug 66550 has been marked as a duplicate of this bug. ***


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2015-06-16  5:22 ` trippels at gcc dot gnu.org
@ 2015-08-13 20:21 ` matt at use dot net
  2015-09-28 21:39 ` wilson at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: matt at use dot net @ 2015-08-13 20:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

Matt Hargett <matt at use dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matt at use dot net

--- Comment #5 from Matt Hargett <matt at use dot net> ---
I also saw this when compiling qemu with latest Ubuntu gcc-snapshot 6.0.0
20150722:


/home/matt/src/qemu-arm/exec.c:462:1: error: type variant has different
TYPE_VFIELD
 };
 ^
 <record_type 0x7fcf97fcc150 VMStateDescription asm_written type_0 BLK
    size <integer_cst 0x7fcf98d34f00 type <integer_type 0x7fcf98f212a0
bitsizetype> constant 576>
    unit size <integer_cst 0x7fcf98dad108 type <integer_type 0x7fcf98f211f8
sizetype> constant 72>
    align 64 symtab -1745049488 alias set -1 canonical type 0x7fcf97fcc150
    fields <field_decl 0x7fcf97c658e8 name
        type <pointer_type 0x7fcf98f421f8 type <integer_type 0x7fcf98f42150
char>
            asm_written public unsigned DI
            size <integer_cst 0x7fcf98f1dca8 constant 64>
            unit size <integer_cst 0x7fcf98f1dcc0 constant 8>
            align 64 symtab -1727089808 alias set -1 canonical type
0x7fcf98f421f8
            pointer_to_this <pointer_type 0x7fcf98f42a80>>
        unsigned DI file /home/matt/src/qemu-arm/include/migration/vmstate.h
line 128 col 17 size <integer_cst 0x7fcf98f1dca8 64> unit size <integer_cst
0x7fcf98f1dcc0 8>
        align 64 offset_align 128
        offset <integer_cst 0x7fcf98f1dcd8 constant 0>
        bit offset <integer_cst 0x7fcf98f1dd20 constant 0> context <record_type
0x7fcf97fcc150 VMStateDescription>
        chain <field_decl 0x7fcf97c65980 unmigratable type <integer_type
0x7fcf98f217e0 int>
            SI file /home/matt/src/qemu-arm/include/migration/vmstate.h line
129 col 9
            size <integer_cst 0x7fcf98f1dee8 constant 32>
            unit size <integer_cst 0x7fcf98f1df00 constant 4>
            align 32 offset_align 128 offset <integer_cst 0x7fcf98f1dcd8 0> bit
offset <integer_cst 0x7fcf98f1dca8 64> context <record_type 0x7fcf97fcc150
VMStateDescription> chain <field_decl 0x7fcf97c65a18 version_id>>>
    chain <type_decl 0x7fcf97fc4850 D.19553>>
 <record_type 0x7fcf97c63e70 VMStateDescription readonly asm_written BLK
    size <integer_cst 0x7fcf98d34f00 type <integer_type 0x7fcf98f212a0
bitsizetype> constant 576>
    unit size <integer_cst 0x7fcf98dad108 type <integer_type 0x7fcf98f211f8
sizetype> constant 72>
    align 64 symtab -1748613568 alias set -1 canonical type 0x7fcf97fcc690
    fields <field_decl 0x7fcf97c658e8 name
        type <pointer_type 0x7fcf98f421f8 type <integer_type 0x7fcf98f42150
char>
            asm_written public unsigned DI
            size <integer_cst 0x7fcf98f1dca8 constant 64>
            unit size <integer_cst 0x7fcf98f1dcc0 constant 8>
            align 64 symtab -1727089808 alias set -1 canonical type
0x7fcf98f421f8
            pointer_to_this <pointer_type 0x7fcf98f42a80>>
        unsigned DI file /home/matt/src/qemu-arm/include/migration/vmstate.h
line 128 col 17 size <integer_cst 0x7fcf98f1dca8 64> unit size <integer_cst
0x7fcf98f1dcc0 8>
        align 64 offset_align 128
        offset <integer_cst 0x7fcf98f1dcd8 constant 0>
        bit offset <integer_cst 0x7fcf98f1dd20 constant 0> context <record_type
0x7fcf97fcc150 VMStateDescription>
        chain <field_decl 0x7fcf97c65980 unmigratable type <integer_type
0x7fcf98f217e0 int>
            SI file /home/matt/src/qemu-arm/include/migration/vmstate.h line
129 col 9
            size <integer_cst 0x7fcf98f1dee8 constant 32>
            unit size <integer_cst 0x7fcf98f1df00 constant 4>
            align 32 offset_align 128 offset <integer_cst 0x7fcf98f1dcd8 0> bit
offset <integer_cst 0x7fcf98f1dca8 64> context <record_type 0x7fcf97fcc150
VMStateDescription> chain <field_decl 0x7fcf97c65a18 version_id>>>
    pointer_to_this <pointer_type 0x7fcf97c63f18>>
/home/matt/src/qemu-arm/exec.c:462:1: internal compiler error: verify_type
failed


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2015-08-13 20:21 ` matt at use dot net
@ 2015-09-28 21:39 ` wilson at gcc dot gnu.org
  2015-09-28 23:05 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: wilson at gcc dot gnu.org @ 2015-09-28 21:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu.org

--- Comment #6 from Jim Wilson <wilson at gcc dot gnu.org> ---
The problem is in c_build_qualified_type.  It calls build_qualified_type at the
end which copies every field to create a new type, including TYPE_VFIELD.  But
this is wrong, as TYPE_VFIELD is set in the main variant type, but should not
be set in the qualified type.  To fix this, I would suggest storing the result
of build_qualify_type in a local var, and then clearing C_TYPE_INCOMPLETE_VARS
(aka TYPE_VFIELD) if this is a struct or union type.

An alternative solution would be to clear TYPE_VFIELD somewhere lower down,
such as in build_distinct_type_copy, but that would affect every front end, so
it isn't obvious if this is safe.  Fixing the problem in the C front end is
clearly a safer solution.


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2015-09-28 21:39 ` wilson at gcc dot gnu.org
@ 2015-09-28 23:05 ` pinskia at gcc dot gnu.org
  2015-10-28 20:02 ` wilson at gcc dot gnu.org
  2015-10-28 20:06 ` wilson at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-09-28 23:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
gombk in SPEC 2k6 has a similar issue.


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2015-09-28 23:05 ` pinskia at gcc dot gnu.org
@ 2015-10-28 20:02 ` wilson at gcc dot gnu.org
  2015-10-28 20:06 ` wilson at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: wilson at gcc dot gnu.org @ 2015-10-28 20:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

--- Comment #8 from Jim Wilson <wilson at gcc dot gnu.org> ---
Author: wilson
Date: Wed Oct 28 20:02:01 2015
New Revision: 229505

URL: https://gcc.gnu.org/viewcvs?rev=229505&root=gcc&view=rev
Log:
Fix for ICE with -g on testcase with incomplete types.

gcc/c/
        PR debug/66068
        * c-typeck.c (c_build_qualified_type): Clear C_TYPE_INCOMPLETE_VARS
        after calling build_qualified_type.
gcc/testsuite/
        PR debug/66068
        * gcc.dg/debug/pr66068.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/debug/pr66068.c
Modified:
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD
  2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2015-10-28 20:02 ` wilson at gcc dot gnu.org
@ 2015-10-28 20:06 ` wilson at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: wilson at gcc dot gnu.org @ 2015-10-28 20:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068

Jim Wilson <wilson at gcc dot gnu.org> changed:

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

--- Comment #9 from Jim Wilson <wilson at gcc dot gnu.org> ---
Fixed on mainline.

Some of the workarounds in verify_type may no longer be necessary.  I haven't
checked.  That should probably be tracked separately if necessary.


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

end of thread, other threads:[~2015-10-28 20:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08  7:41 [Bug c/66068] New: error: type variant has different TYPE_VFIELD dcb314 at hotmail dot com
2015-05-11 14:56 ` [Bug debug/66068] [6 Regression] " mpolacek at gcc dot gnu.org
2015-05-11 14:56 ` mpolacek at gcc dot gnu.org
2015-05-11 15:02 ` mpolacek at gcc dot gnu.org
2015-06-16  5:22 ` trippels at gcc dot gnu.org
2015-08-13 20:21 ` matt at use dot net
2015-09-28 21:39 ` wilson at gcc dot gnu.org
2015-09-28 23:05 ` pinskia at gcc dot gnu.org
2015-10-28 20:02 ` wilson at gcc dot gnu.org
2015-10-28 20:06 ` wilson at gcc dot gnu.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).