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

TypeInfo is stored read-only, but mutable from D #1337

Closed
cym13 opened this issue Mar 4, 2016 · 6 comments
Closed

TypeInfo is stored read-only, but mutable from D #1337

cym13 opened this issue Mar 4, 2016 · 6 comments

Comments

@cym13
Copy link

cym13 commented Mar 4, 2016

Reduced (thanks dustmite) test case:

struct A{}
void main(){
    A a;
    auto y = typeid(a);
    y.name = "Nope, I'm not A";
}

LDC segfaults when compiling the test case without flag.

Version:

LDC - the LLVM D compiler (0.17.0):
  based on DMD v2.068.2 and LLVM 3.7.1
  Default target: x86_64-unknown-linux-gnu
  Host CPU: sandybridge

Arguably one shouldn't be able to even try to change a typeid's name but
dmd2.068.2 -> 2.070.2 (last version at the time) accepts it.

@cym13
Copy link
Author

cym13 commented Mar 4, 2016

Sorry, just saw the "Reporting LDC issues" section of the wiki:

System: GNU/Linux Archlinux
Architecture: x86_64
LLVM: 3.7.1-1 (from package)
LDC: 0.17.0 (from package)

@redstar
Copy link
Member

redstar commented Mar 6, 2016

Hm. LDC does not segfault but the resulting binary.

@cym13
Copy link
Author

cym13 commented Mar 6, 2016

Sorry, I don't know why I confused the two, you are perfectly right.

@JohanEngelen
Copy link
Member

Is this UB or an LDC bug?

@UplinkCoder
Copy link
Contributor

Woohoo a leet issue.

@dnadlinger dnadlinger changed the title segfault when changing a typeid name TypeInfo is stored read-only, but mutable from D Mar 15, 2016
@redstar
Copy link
Member

redstar commented Mar 24, 2016

Fixed in all branches.

@redstar redstar closed this as completed Mar 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants