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

Build failure, dmd 2.088: cast from int to void* not allowed in safe code #27

Closed
jondegenhardt opened this issue Oct 31, 2019 · 17 comments
Assignees

Comments

@jondegenhardt
Copy link

I have started seeing io package (v0.2.2) build failures when building jondegenhardt/dcat-perf. Builds are failing with an error in driver/package.d. The error occurs starting with DMD 2.088 / LDC 1.18.0. I suspect the build failure is a result of DMD PR #10056. The build error is:

$ dub build --compiler=ldc2
Performing "debug" build using ldc2 for x86_64.
io 0.2.2: building configuration "library"...
../../../../.dub/packages/io-0.2.2/io/src/std/io/driver/package.d(51,25): Error: cast from int to void* not allowed in safe code
../../../../.dub/packages/io-0.2.2/io/src/std/io/driver/package.d(95,27): Error: cast from int to void* not allowed in safe code

There are additional errors, but I suspect that they are a consequence of the initial errors. Compilation with DMD 2.087 / LDC 1.17.0 is fine.

The full build error log can be seen here: https://travis-ci.com/jondegenhardt/dcat-perf/builds/134325392. Look at the log of any of the failed builds.

@schveiguy
Copy link
Owner

I'll take a look tomorrow. Running into the same issue.

@schveiguy schveiguy self-assigned this Nov 5, 2019
@schveiguy
Copy link
Owner

@jondegenhardt I think this is fixed in master. When I dub add-local io to my repo with my latest changes, it works. Probably just needs a release. I'll tag, let me know if it helps.

@jondegenhardt
Copy link
Author

jondegenhardt commented Nov 6, 2019

Thanks for looking at this Steve. I was wondering if your recent changes would fix it. I'll try it after you tag it. I'm pulling the io package through iopipe. If I understand, the iopipe dependency will automatically pull a new patch release, so a tag like v0.2.3 should get it.

Separate thing, but the reason it'll work is because the cast was moved outside of the @safe: section, right? Anyway, this case made me wonder what the appropriate @safe mechanism would be. This cast involved, cast(void*)-1, is a standard 'C' idiom.

Update: Ah, you've already tagged it. Will test. Need to wait for the version change to propagate to code.dlang.org first.

@schveiguy
Copy link
Owner

heh, I just checked and it didn't get updated to code.dlang.org. But I realized I forgot the v. So that should be fixed. Hopefully updates soon.

@jondegenhardt
Copy link
Author

jondegenhardt commented Nov 6, 2019

A mixed bag. DMD 2.088.1 now works with io-0.2.3. However, DMD 2.089.0 fails to compile. Looks related to the recent changes to shared/atomics (see the change log and this forum thread: https://forum.dlang.org/thread/qpml3c$up8$1@digitalmars.com).

Very oddly, the LDC 1.18.0 build segment faults when running command line tests. (Run against the built executable.) This is very odd in that LDC 1.18.0 is based on DMD 2.088.1, which now passes.

So, there may be two separate issues. I'll take a closer look and let you know what I find. Not sure I'll get to it tomorrow, but will update here when I do.

The build logs are available here: travis-ci: dcat-perf

  • The new dmd-2.089.0 failure: build 3
  • The ldc-1.18.0 build segment fault: build 6

It is possible of course that the LDC seg fault is due to something I wrote rather than something in io. Seems unlikely to be from the tsv-utils library code pulled in, as that is tested much more rigorously with the same compilers. But dcat-perf also has some of its own code, so it could have failed there.

@schveiguy
Copy link
Owner

schveiguy commented Nov 6, 2019

Hm... reading that thread, especially since we do almost exactly the same thing here: https://github.com/MartinNowak/io/blob/2147802a9bca0dcf82293303f407dd3e253691e9/src/std/io/driver/package.d#L243

I think we probably need to wait for that bug to be fixed and address the "correct" way to do things when 2.089.1 is out. Keep me informed, I'm pretty disconnected from the forums these days.

I don't know about the segfault for LDC that doesn't fail when you use DMD, we may need to report that to LDC. I don't generally use LDC for my projects.

@jondegenhardt
Copy link
Author

Sounds good. I'll see if I can narrow down the LDC case a bit and report it.

@kinke FYI on possible LDC issue. See my note two comments back. Might be a day or two, but I'll be trying to narrow this further.

@PetarKirov
Copy link

PetarKirov commented Nov 6, 2019

Guys, consider adding this project to the project tester after you get it green with dmd nightly. It looks like we're missing some test coverage and adding io to the list will not only ensure its build stays green with new compiler releases, but also prevent such problems from affecting other projects.

@schveiguy
Copy link
Owner

@PetarKirov yes, will do.

@schveiguy
Copy link
Owner

@bioinfornatics Looks like you hit this same issue with LDC.

@jondegenhardt see issue he filed: ldc-developers/ldc#3219

@kinke
Copy link
Contributor

kinke commented Nov 7, 2019

Wrt. the 'LDC issue', somebody please test #30, as I haven't, but am pretty sure this is the culprit, and only worked accidentally for cas() implementations reinterpret-casting the value to be stored to the destination type (=> not offsetting class to interface pointer), which is more likely actually a DMD issue if it still persists with 2.089.

@jondegenhardt
Copy link
Author

@schveiguy Looks like the LDC issue is fixed, right? If so, if you tag another version of io I'll kick off my CI tests. That'll should close this issue. It'll also have the effect of checking a number of LDC builds.

@schveiguy
Copy link
Owner

OK tagged, @jondegenhardt, now have to just wait for dub to notice.

@jondegenhardt
Copy link
Author

jondegenhardt/dcat-perf Travis-CI done. Results as expected. ldc-1.18.0 now passes. dmd-2.089.0 / ldc-1.19.0-beta1 fail on the shared/atomics issue.

@schveiguy
Copy link
Owner

OK, so I'll close this, and open an issue for 2.089.0, as this one as originally reported is fixed.

@jondegenhardt
Copy link
Author

jondegenhardt commented Feb 23, 2020

Hi @schveiguy - I've lost track - What's the status of this? Are we still waiting for something to be fixed in shared atomics on Phobos?

I ask because jondegenhardt/dcat-perf CI builds continue to fail (weekly) for latest dmd and ldc compilers. Same failure on each. E.g.:

DMD64 D Compiler v2.090.1
...
Fetching iopipe 0.1.7 (getting selected version)...
Fetching io 0.2.4 (getting selected version)...
...
../../../.dub/packages/io-0.2.4/io/src/std/io/driver/package.d(243,12):
Error: template core.atomic.cas cannot deduce function from argument types !()(shared(Driver)*, typeof(null), shared(Driver)), candidates are:

This repo is not especially important, so it doesn't matter so much if it fails. But, this strikes me as an important issue, I'm surprised it hasn't been fixed. Or, maybe it has, but I'm just not pulling the correct versions of iopipe and io.

@schveiguy
Copy link
Owner

schveiguy commented Feb 24, 2020 via email

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