[Issue 24] New: GDC backend uses invalid type when using deferencing toPtr on a static array inside of a struct.

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Mon Oct 29 14:40:14 PDT 2012


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

             Bug #: 24
           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 at gdcproject.org
        ReportedBy: venix1 at gmail.com


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

====

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;
}

====

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 
char
char*
char[1LU]
test.d: In function ‘D main’:
test.d:8: error: mismatching comparison operand types
char[1]
int
if (D.2039 != 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.

-- 
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all issue changes.


More information about the D.gnu mailing list