Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 22, 2020 [Issue 20969] alias to local in static | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 John Colvin <john.loughran.colvin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |industry -- |
June 22, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault when read | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 John Colvin <john.loughran.colvin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|alias to local in static |alias to local in static | |instance of a struct causes | |segfault when read -- |
June 22, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 John Colvin <john.loughran.colvin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|alias to local in static |alias to local in static |instance of a struct causes |instance of a struct causes |segfault when read |segfault -- |
June 22, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 Stefan Koch <uplink.coder@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |uplink.coder@gmail.com --- Comment #1 from Stefan Koch <uplink.coder@gmail.com> --- I Assume: this happens because `a` is a local t the frame of main. when s.bar is called it uses the same offset but in the frame of bar. My first solution would be to make it an error. -- |
June 22, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |simen.kjaras@gmail.com --- Comment #2 from Simen Kjaeraas <simen.kjaras@gmail.com> --- I'm not sure this is exactly the same issue, but it's certainly analogous: unittest { import std.stdio; int i; writeln("Outside: ", &i); static fn = (){ writeln("Inside: ", &i); ++i; }; writeln("Context: ", fn.ptr); fn(); } Output: Outside: 3100014 Context: null Inside: 4 (0): [unittest] Access Violation As we can see, the context pointer for the delegate is not initialized. Making it compile would either be equivalent to making 'i' static, or have different behavior for the first and consequent calls, as only the first would have its 'i' modified by calls to fn(). Sensible workarounds do exist, this is most likely to be a mistake by the programmer, and having it work requires that this corner case be described somewhere. I say make it an error. -- |
June 22, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 --- Comment #3 from Simen Kjaeraas <simen.kjaras@gmail.com> --- (In reply to Simen Kjaeraas from comment #2) > Making it compile Ahem. Making it *work*. -- |
June 22, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 Stefan Koch <uplink.coder@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Assignee|nobody@puremagic.com |uplink.coder@gmail.com -- |
August 09, 2020 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|wrong-code |accepts-invalid CC| |bugzilla@digitalmars.com --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> --- The compiler is attempting to produce a compile-time static initializer for main.s, using a value that only exists at runtime. This is definitely accepts-invalid, not wrong-code. -- |
December 17, 2022 [Issue 20969] alias to local in static instance of a struct causes segfault | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20969 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
Copyright © 1999-2021 by the D Language Foundation