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

ICE when using va_start in non-variadic function #2412

Open
Temtaime opened this issue Nov 17, 2017 · 5 comments
Open

ICE when using va_start in non-variadic function #2412

Temtaime opened this issue Nov 17, 2017 · 5 comments

Comments

@Temtaime
Copy link
Contributor

Temtaime commented Nov 17, 2017

struct ASTBase
{
    import core.stdc.stdarg;

    extern (C++) final error(const(char) *format)
    {
      va_list ap;
      va_start(ap, format);
    }
}

Compile using -march=x86 and it crashes:
Wrote crash dump file ...

@Temtaime
Copy link
Contributor Author

Temtaime commented Nov 18, 2017

It is valid code used in DMD.
You can add missing va_end and ... and it will fail.

@kinke
Copy link
Member

kinke commented Nov 18, 2017

Well for a proper C-style vararg declaration, it's missing a , ..., after which it obviously works.

@Temtaime
Copy link
Contributor Author

Oh, sorry, my fault
https://github.com/dlang/dmd/blob/master/src/ddmd/astbase.d#L437
There's some shit in dmd

@dnadlinger
Copy link
Member

dnadlinger commented Nov 18, 2017

We should certainly issue a nicer error message instead of crashing, though.

@kinke
Copy link
Member

kinke commented Nov 19, 2017

@Temtaime: Thx for fixing the upstream bug.

@dnadlinger dnadlinger changed the title LDC 1.5.0 crash on x86 ICE when using va_start in non-variadic function Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants