[Issue 18461] New: core.bitop.bt returns garbage in release code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 18 23:01:32 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18461

          Issue ID: 18461
           Summary: core.bitop.bt returns garbage in release code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: feklushkin.denis at gmail.com

This code should return exception in debug version or -4 exit code in release
version. But in release version sometimes (50/50) it isn't fails.

Faced this in another situation and reduced code to this sample. Also, tried to
replace it with writeln(bt_result); and this issue is gone.

/++ dub.sdl:
name "bitop_bt"
description "test"
+/
import core.bitop;

void main()
{
    size_t test_val = 0b0001_0000;

    if(bt(&test_val, 4) != 0)
        assert(false);
}

How to run:
$ dub run --single bitop_bt.d --build=release

Output:
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./bitop_bt 
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: building configuration "application"...
Linking...
Running ./bitop_bt 
Program exited with code -4
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: building configuration "application"...
Linking...
Running ./bitop_bt 
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./bitop_bt 
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: building configuration "application"...
Linking...
Running ./bitop_bt 
Program exited with code -4
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./bitop_bt 
Program exited with code -4
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: building configuration "application"...
Linking...
Running ./bitop_bt 
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./bitop_bt 
Program exited with code -4
denizzz at localhost:~/Dev$ dub run --single bitop_bt.d --build=release
Performing "release" build using /usr/bin/dmd for x86_64.
bitop_bt ~master: building configuration "application"...
Linking...
Running ./bitop_bt 
denizzz at localhost:~/Dev$ 

My system is 64bit Intel.
$ dmd --version
DMD64 D Compiler v2.078.2
Copyright (c) 1999-2017 by The D Language Foundation written by Walter Bright
$ dub --version
DUB version 1.7.2, built on Feb  7 2018

--


More information about the Digitalmars-d-bugs mailing list