struct L { void *a; };
struct S {
  static S *foo (L *x)
  {
    return (S *) ((char *) x - (unsigned long) &(((S *) 0)->*&S::a));
  }
  L a;
};

causes ICE in fold_convert (abort at the very end of the function).
Works fine with G++ 3.2.3-RH and HEAD.
Breakpoint 2, fold_convert (type=0x2a97b66d00, arg=0x2a97d65c60) at
../../gcc/fold-const.c:1917
1917      abort ();
(gdb) p debug_tree(type)
 <integer_type 0x2a97b66d00 long int DI
    size <integer_cst 0x2a97b64930 type <integer_type 0x2a97b78410 
bit_size_type>
constant 64>
    unit size <integer_cst 0x2a97b64a80 type <integer_type 0x2a97b78340 long
unsigned int> constant 8>
    align 64 symtab 0 alias set -1 precision 64 min <integer_cst 0x2a97b64a20
-9223372036854775808> max <integer_cst 0x2a97b64a50 9223372036854775807>>
$1 = void
(gdb) p debug_tree(arg)
 <negate_expr 0x2a97d65c60
    type <offset_type 0x2a97d63820
        type <record_type 0x2a97d58680 L type_1 type_5 DI
            size <integer_cst 0x2a97b749c0 constant 64>
            unit size <integer_cst 0x2a97b74a80 constant 8>
            align 64 symtab 0 alias set -1 fields <field_decl 0x2a97d589c0 a>
            X() X(constX&) this=(X&) n_parents 0 use_template=0 
interface-unknown
            member-functions <tree_vec 0x2a97d5d980
                elt 0 <overload 0x2a97d50fc0>
                elt 2 <function_decl 0x2a97d5fa90 operator=>
                elt 3 <overload 0x2a97d61040>
                elt 4 <overload 0x2a97d61000>>
            pointer_to_this <pointer_type 0x2a97d58750> reference_to_this
<reference_type 0x2a97d5f680> chain <type_decl 0x2a97d58820 L>>
        DI size <integer_cst 0x2a97b749c0 64> unit size <integer_cst 
0x2a97b74a80
8>
        align 64 symtab 0 alias set -1 basetype <record_type 0x2a97d604e0 S>>
    constant
    arg 0 <ptrmem_cst 0x2a97d658a0 type <offset_type 0x2a97d63820>
        constant>>
$2 = void

-- 
           Summary: ICE in fold_convert
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to