public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46866] New: [4.5/4.6 Regression] ICE: type mismatch in address expression
@ 2010-12-09 14:31 rguenth at gcc dot gnu.org
  2010-12-09 14:33 ` [Bug tree-optimization/46866] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-09 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.5/4.6 Regression] ICE: type mismatch in address
                    expression
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-checking
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


extern void *malloc(__SIZE_TYPE__);
typedef struct T T;
struct T {
    void (*destroy)(void *);
};
void destroy(union { void *this; } __attribute__((transparent_union)));
static const typeof(destroy) *_destroy  = (const typeof(destroy)*)destroy;
void destroy(void *this);
static T *create_empty(void) 
{
  T *this = malloc(sizeof(*this));
  *this = (typeof(*this)){ _destroy };
  return this;
}
void openssl_crl_load(void)
{
  T *this = create_empty();
  destroy(this);
}

ICEs with

> ./cc1 -quiet openssl_crl.3.3.3.i  -O
openssl_crl.3.3.3.i: In function 'openssl_crl_load':
openssl_crl.3.3.3.i:15:6: error: type mismatch in address expression
void (*<T357>) (union 
{
  void * this;
})

void <T9d> (void *)

_destroy.0_6 = destroy;

openssl_crl.3.3.3.i:15:6: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


because of the appearant mismatch of the function prototye of destroy
with regarting to the transparent_union attribute.

Appearantly the C frontend has the transparent union prototype type
in function create_empty () while it has the other prototype type
in effect after IPA inlining (after the address-expression is built).

The types are munged together without diagnostic here:

Old value = (tree) 0x7ffff5cfa738
New value = (tree) 0x7ffff7efe7e0
0x000000000049c987 in merge_decls (newdecl=0x7ffff5d16100, 
    olddecl=0x7ffff5d16000, newtype=0x7ffff7efe7e0, oldtype=0x7ffff5cfa738)
    at /space/rguenther/src/svn/trunk/gcc/c-decl.c:2173
2172      /* Merge the data types specified in the two decls.  */
2173      TREE_TYPE (newdecl)
2174        = TREE_TYPE (olddecl)
2175        = composite_type (newtype, oldtype);

but existing TYPE_POINTER/REFERENCE_TO are not merged.

(gdb) p newdecl->base.addressable_flag 
$9 = 0
(gdb) p olddecl->base.addressable_flag 
$10 = 1

with unit-at-a-time gimplification we try to fixup here, but we never
visit static initializers like

static const typeof(destroy) *_destroy  = (const typeof(destroy)*)destroy;

I have a patch.


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

* [Bug tree-optimization/46866] [4.5/4.6 Regression] ICE: type mismatch in address expression
  2010-12-09 14:31 [Bug tree-optimization/46866] New: [4.5/4.6 Regression] ICE: type mismatch in address expression rguenth at gcc dot gnu.org
@ 2010-12-09 14:33 ` rguenth at gcc dot gnu.org
  2010-12-09 17:01 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-09 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.4.4
   Target Milestone|---                         |4.5.2


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

* [Bug tree-optimization/46866] [4.5/4.6 Regression] ICE: type mismatch in address expression
  2010-12-09 14:31 [Bug tree-optimization/46866] New: [4.5/4.6 Regression] ICE: type mismatch in address expression rguenth at gcc dot gnu.org
  2010-12-09 14:33 ` [Bug tree-optimization/46866] " rguenth at gcc dot gnu.org
@ 2010-12-09 17:01 ` rguenth at gcc dot gnu.org
  2010-12-16 13:23 ` [Bug tree-optimization/46866] [4.5 " rguenth at gcc dot gnu.org
  2011-03-08 13:11 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-09 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.09 17:00:48
      Known to work|                            |4.6.0
     Ever Confirmed|0                           |1
      Known to fail|                            |4.5.2

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-09 17:00:48 UTC ---
Fixed on trunk.


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

* [Bug tree-optimization/46866] [4.5 Regression] ICE: type mismatch in address expression
  2010-12-09 14:31 [Bug tree-optimization/46866] New: [4.5/4.6 Regression] ICE: type mismatch in address expression rguenth at gcc dot gnu.org
  2010-12-09 14:33 ` [Bug tree-optimization/46866] " rguenth at gcc dot gnu.org
  2010-12-09 17:01 ` rguenth at gcc dot gnu.org
@ 2010-12-16 13:23 ` rguenth at gcc dot gnu.org
  2011-03-08 13:11 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-16 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.5.2                       |4.5.3

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-16 13:03:35 UTC ---
GCC 4.5.2 is being released, adjusting target milestone.


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

* [Bug tree-optimization/46866] [4.5 Regression] ICE: type mismatch in address expression
  2010-12-09 14:31 [Bug tree-optimization/46866] New: [4.5/4.6 Regression] ICE: type mismatch in address expression rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-12-16 13:23 ` [Bug tree-optimization/46866] [4.5 " rguenth at gcc dot gnu.org
@ 2011-03-08 13:11 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-08 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.5.3                       |4.6.0

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-08 13:11:23 UTC ---
For reference:

Author: rguenth
Date: Thu Dec  9 17:00:19 2010
New Revision: 167649

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167649
Log:
2010-12-09  Richard Guenther  <rguenther@suse.de>

    PR middle-end/46844
    * gimple-fold.c (canonicalize_constructor_val): Canonicalize
    addresses.

    * gcc.c-torture/compile/pr46866.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr46866.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/testsuite/ChangeLog

no trivial backport exists and is not worthwhile (checking-only ICE).


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

end of thread, other threads:[~2011-03-08 13:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09 14:31 [Bug tree-optimization/46866] New: [4.5/4.6 Regression] ICE: type mismatch in address expression rguenth at gcc dot gnu.org
2010-12-09 14:33 ` [Bug tree-optimization/46866] " rguenth at gcc dot gnu.org
2010-12-09 17:01 ` rguenth at gcc dot gnu.org
2010-12-16 13:23 ` [Bug tree-optimization/46866] [4.5 " rguenth at gcc dot gnu.org
2011-03-08 13:11 ` rguenth 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).