[Issue 1573] New: ICE when using -O flag and static if's

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 11 16:16:45 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1573

           Summary: ICE when using -O flag and static if's
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: jeffd at gwava.com


I made some performance changes by adding a static if to a hash keyCompare
function to deal with null.opEquals issues:

private bool _keyCompare(T first, T second)
{
        static if (is(T : Object))
                return cast(bool)(first ? first == second : second is null);
        return cast(bool)(second == first);
}       

While testing, I was able to compile fine (with -O, etc), however, linking in a
Config module that uses the Hash template in several places, I get: 

tetra/util/container/Hash.d: In member function ‘_keyCompare’:
tetra/util/container/Hash.d:215: internal compiler error: in emit_move_insn, at
expr.c:3162
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.

Line 215.d of Hash.d is the declaration of the _keyCompare function.

That's with compiling with -O -release. Removing the -O it compiles and runs as
expected.

Changing the line:      return cast(bool)(second == first); to just return
false; also allows compilation without error (but doesn't run as expected,
obviously).


-- 



More information about the D.gnu mailing list