Bug 15047 – "used before set" error with void initialization (only with -O)
Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-09-12T12:19:00Z
Last change time
2016-09-04T10:36:53Z
Assigned to
nobody
Creator
schuetzm
Comments
Comment #0 by schuetzm — 2015-09-12T12:19:15Z
// xx.d
int testCopy()
{
int a = void;
int b = void;
int fun(int x) { int y = x; return y; }
b = fun(a);
return b;
}
# dmd -c -O xx.d
xx.d(7): Error: variable a used before set
# dmd -c xx.d
(no error)
This currently breaks compiling vibe.d with optimization for me:
vibe/core/core.d(1693,11): Error: variable a used before set
I'm going to try and see if I can get digger to work again...
Comment #1 by dlang-bugzilla — 2015-09-28T09:05:15Z
(In reply to Marc Schütz from comment #0)
> I'm going to try and see if I can get digger to work again...
The error occurs as far back as DMD 2.027.
(In reply to Andrei Alexandrescu from comment #4)
> I'm confused. Isn't the error legit?
Is it, but the fact that it's only triggered with optimisation enabled is not legit.
Comment #6 by bugzilla — 2016-09-04T08:36:54Z
(In reply to Marc Schütz from comment #0)
> This currently breaks compiling vibe.d with optimization for me:
It did find a bug in vibe.d. Why not fix it?
Comment #7 by bugzilla — 2016-09-04T10:36:53Z
Resolving as "wontfix" until a more compelling rationale for changing it is posted.