[Issue 10540] New: variable used before set for empty static arrays, with -inline -O
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 4 02:15:48 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10540
Summary: variable used before set for empty static arrays, with
-inline -O
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at gmail.com 2013-07-04 02:15:47 PDT ---
Thread:
http://forum.dlang.org/thread/khdhvzfdfljbtlyfqocw@forum.dlang.org#post-khdhvzfdfljbtlyfqocw:40forum.dlang.org
When compiled with -O -inline:
--------
struct S
{
int[0] a;
void do_it()
{
foo(a);
}
}
void foo(Args...)(Args args)
{
//foreach(arg; args)
// if (arg.ptr == null)
// return;
bar(args);
}
void bar(Args...)(Args args)
{
foreach(arg; args)
if (arg.ptr == null)
return;
}
void main()
{}
--------
Produces:
main.d(11): Error: variable _param_0 used before set
--------
Possibly the compiler optimizes out a's initialization, since it is an empty
static array.
Code is glitchy: Not only does the bug appear only in bar (and not foo),
un-commenting the code in foo will *fix* the call in bar...
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list