Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Conversation

@kinke
Copy link
Member

@kinke kinke commented Mar 25, 2018

Cherry-pick of dlang#2151 (still pending).

I don't know if the fixed bug has the potential of being the cause for the EH issue on ARM and other EH strangeness, but it could have caused a segfault due to reading 250 bytes past the ??:? \0 string constant, if I studied the code correctly.

@kinke
Copy link
Member Author

kinke commented Mar 25, 2018

Yep, when using a 64K buffer, the executable segfaults reproducibly for run.dlang.io: https://run.dlang.io/is/iKTnTh

That must be an invalid optimization on our part, as with -O alone, there's this call (which would throw an exception - while generating a previous exception's stack trace...):

call void @_d_array_slice_copy(i8* nocapture nonnull %buffer1.sub, i64 65536, i8* nocapture getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 6

with clearly diverging sizes (65536 vs. 6), so adding -release shouldn't replace the call by a 64KB-memcpy.

Edit: Well, DMD shows the same issue - exception with -O alone, segfault with -release (with and without -O) (using a 128K buffer) - it's just the disabled bounds checks. Given that the lengths would be statically known, that's a bit surprising/disappointing, but oh well.

@kinke
Copy link
Member Author

kinke commented Mar 27, 2018

I tested Joakim's reduced testcase with this in the ARM emulator, still fails.

@kinke
Copy link
Member Author

kinke commented Apr 29, 2018

I just hit this again on Ubuntu 18.04.

@kinke kinke merged commit f8aa396 into ldc-developers:ldc Apr 29, 2018
@kinke kinke deleted the bt_dwarf_ldc branch April 29, 2018 17:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant