www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 24] New: GDC backend uses invalid type when using deferencing

http://gdcproject.org/bugzilla/show_bug.cgi?id=3D24


           Summary: GDC backend uses invalid type when using deferencing
                    toPtr on a static array inside of a struct.
    Classification: Unclassified
           Product: GDC
           Version: 4.8.x
          Platform: x86
        OS/Version: Other
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
        AssignedTo: ibuclaw gdcproject.org
        ReportedBy: venix1 gmail.com


The following code snippet will cause an ICE within the compiler.  This
occurred with GDC 4.8 head as of October 4th.

=3D=3D=3D=3D

struct a
{
    char[1] b;
}

a c;

void main()
{
    pragma(msg, typeof(*c.b.ptr));
    pragma(msg, typeof(c.b.ptr));
    pragma(msg, typeof(c.b));
    if (*c.b.ptr)
        return;
    return;
}

=3D=3D=3D=3D

The type used by GCC for *c.b.ptr is char[1LU] when it should be char as
reported by D's type system.


$ gdc test.d=20
char
char*
char[1LU]
test.d: In function =E2=80=98D main=E2=80=99:
test.d:8: error: mismatching comparison operand types
char[1]
int
if (D.2039 !=3D 0) goto <D.2040>; else goto <D.2041>;

test.d:8: internal compiler error: verify_gimple failed
0x98f4af verify_gimple_in_seq(gimple_statement_d*)
    ../../gcc-4.8-20121007/gcc/tree-cfg.c:4531
0x828cb4 gimplify_body(tree_node*, bool)
    ../../gcc-4.8-20121007/gcc/gimplify.c:8232
0x829005 gimplify_function_tree(tree_node*)
    ../../gcc-4.8-20121007/gcc/gimplify.c:8319
0x6d1147 cgraph_analyze_function
    ../../gcc-4.8-20121007/gcc/cgraphunit.c:643
0x6d3f8e cgraph_analyze_functions
    ../../gcc-4.8-20121007/gcc/cgraphunit.c:928
0x6d4e50 finalize_compilation_unit()
    ../../gcc-4.8-20121007/gcc/cgraphunit.c:2071
0x61c704 d_write_global_declarations
    ../../gcc-4.8-20121007/gcc/d/d-lang.cc:643
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

--=20
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=3Dema=
il
------- You are receiving this mail because: -------
You are watching all issue changes.=
Oct 29 2012