Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[asan] stack-overflow in optelem #19360

Open
dlangBugzillaToGithub opened this issue Jan 3, 2018 · 3 comments
Open

[asan] stack-overflow in optelem #19360

dlangBugzillaToGithub opened this issue Jan 3, 2018 · 3 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

Martin Nowak (@MartinNowak) reported this on 2018-01-03T22:15:34Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=18189

CC List

Description

Created attachment 1673
ASan log

Occured while running compilable/test11559upgradeoptlink.d.

=================================================================
==12572==ERROR: AddressSanitizer: stack-overflow on address 0x7ffef7005ff8 (pc 0x000000c5bda3 bp 0x7ffef70060b0 sp 0x7ffef7005500 T0)
    #0 0xc5bda2 in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5bda2)
    #1 0xc5dcad in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5dcad)
    #2 0xc5dd8f in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5dd8f)
    #3 0xc5dd8f in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5dd8f)
    #4 0xc5c4e8 in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5c4e8)
    #5 0xc7cc28 in eloror(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc7cc28)

...

    #250 0xc5c4e8 in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5c4e8)

SUMMARY: AddressSanitizer: stack-overflow (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5bda2) in optelem(elem*, unsigned int)
==12572==ABORTING


==============================

!!!There are attachements in the bugzilla issue that have not been copied over!!!

@dlangBugzillaToGithub
Copy link
Author

bugzilla (@WalterBright) commented on 2018-01-04T00:21:35Z

The failing test case is:

  string gen() {
    string m;
    foreach(i; 0..4096)
        m ~= "mixin(\"assert(0);\n\n\n\n\");\n";
    return m;
  }

  void main() {
    mixin(gen());
  }

@dlangBugzillaToGithub
Copy link
Author

bugzilla (@WalterBright) commented on 2018-01-04T00:25:45Z

This is a stack overflow caused by having 4096 expression statements. The compiler joins them with a commaexpression, and then recursively traverses it. The best fix would be to convert it to an array or list of expression statements, but that would have ripple effects throughout the back end.

@dlangBugzillaToGithub
Copy link
Author

code (@MartinNowak) commented on 2018-01-04T21:37:51Z

Not sure it's worthwhile to fix it, maybe just add a recursion limit to optelem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant