[Issue 14502] dmd -O optimization breaks app

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P1  |P3

--


[Issue 14502] dmd -O optimization breaks app

2015-04-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #9 from Tomáš Chaloupka chalu...@gmail.com ---
So it ended up with an indeterministic version which sometimes pass, sometimes
fails in all switches :(
Is it actually failing for anyone else?

--


[Issue 14502] dmd -O optimization breaks app

2015-04-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #8 from Tomáš Chaloupka chalu...@gmail.com ---
Actually read it before. Tried to use prepared script with specific backtrace,
but could not make it work with timeout (wrong output from gdb then).

So now trying with just simple:

#!/bin/bash
TIME=12
timeout $TIME rdmd --force -O -release test.d 21  /dev/null
if [ $? -eq 139 ]; then
timeout $TIME rdmd --force -release test.d 21  /dev/null
if [ $? -eq 124 ]; then
timeout $TIME rdmd --force test.d 21  /dev/null
if [ $? -eq 124 ]; then
exit 0
else
exit 1
fi
else
exit 1
fi
fi
exit 1

which is at least faster thanks to timeout usage.

--


[Issue 14502] dmd -O optimization breaks app

2015-04-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

Vladimir Panteleev thecybersha...@gmail.com changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com

--- Comment #3 from Vladimir Panteleev thecybersha...@gmail.com ---
(In reply to Tomáš Chaloupka from comment #1)
 Its really hard for me (as a D noob) to dustmite something usable from this
 :(

See here:

https://github.com/CyberShadow/DustMite/wiki/Reducing-a-regression-between-two-D-versions

Except that instead of compiling with two versions of D, compile once without
-O and once with -O.

--


[Issue 14502] dmd -O optimization breaks app

2015-04-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #2 from Tomáš Chaloupka chalu...@gmail.com ---
I can confirm, that the problem still exists for 2.067.1
Only it sometimes behaves differently.

On the first try it worked, but after that no..

Once it ended up with:
*** Error in `./test': double free or corruption (out): 0x7f7b0cd1a010 ***
=== Backtrace: =
/lib64/libc.so.6(+0x72f5f)[0x7f7b1450bf5f]
/lib64/libc.so.6(+0x7839e)[0x7f7b1451139e]
/lib64/libc.so.6(+0x790e6)[0x7f7b145120e6]
/opt/dmd-2.067/lib64/libphobos2.so.0.67(_D2gc2gc3Gcx4DtorMFZv+0x401)[0x7f7b152fbac9]
=== Memory map: 
0040-00407000 r-xp  08:04 5904474   
/home/tomas/workspace/benchmarks/havlak/bug/clean/test
00607000-00608000 r--p 7000 08:04 5904474   
/home/tomas/workspace/benchmarks/havlak/bug/clean/test
00608000-00609000 rw-p 8000 08:04 5904474   
/home/tomas/workspace/benchmarks/havlak/bug/clean/test
01b83000-0218a000 rw-p  00:00 0  [heap]
7f7b035f9000-7f7b07ff9000 rw-p  00:00 0
7f7b0861a000-7f7b0cd65000 rw-p  00:00 0
7f7b0e6f3000-7f7b0e709000 r-xp  00:10 147065185 
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.2/libgcc_s.so.1
7f7b0e709000-7f7b0e908000 ---p 00016000 00:10 147065185 
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.2/libgcc_s.so.1
7f7b0e908000-7f7b0e909000 r--p 00015000 00:10 147065185 
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.2/libgcc_s.so.1
7f7b0e909000-7f7b0e90a000 rw-p 00016000 00:10 147065185 
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.2/libgcc_s.so.1
7f7b0e965000-7f7b12ee5000 rw-p  00:00 0
7f7b12ee5000-7f7b12ef8000 r-xp  00:10 138567531 
/lib64/libresolv-2.20.so
7f7b12ef8000-7f7b130f8000 ---p 00013000 00:10 138567531 
/lib64/libresolv-2.20.so
7f7b130f8000-7f7b130f9000 r--p 00013000 00:10 138567531 
/lib64/libresolv-2.20.so
7f7b130f9000-7f7b130fa000 rw-p 00014000 00:10 138567531 
/lib64/libresolv-2.20.so
7f7b130fa000-7f7b130fc000 rw-p  00:00 0
7f7b130fc000-7f7b13111000 r-xp  00:10 39352853  
/lib64/libz.so.1.2.8
7f7b13111000-7f7b1331 ---p 00015000 00:10 39352853  
/lib64/libz.so.1.2.8
7f7b1331-7f7b13311000 r--p 00014000 00:10 39352853  
/lib64/libz.so.1.2.8
7f7b13311000-7f7b13312000 rw-p 00015000 00:10 39352853  
/lib64/libz.so.1.2.8
7f7b13312000-7f7b13359000 r-xp  00:10 136807347 
/usr/lib64/libldap-2.4.so.2.10.3
7f7b13359000-7f7b13559000 ---p 00047000 00:10 136807347 
/usr/lib64/libldap-2.4.so.2.10.3
7f7b13559000-7f7b1355a000 r--p 00047000 00:10 136807347 
/usr/lib64/libldap-2.4.so.2.10.3
7f7b1355a000-7f7b1355c000 rw-p 00048000 00:10 136807347 
/usr/lib64/libldap-2.4.so.2.10.3
7f7b1355c000-7f7b1356a000 r-xp  00:10 136807348 
/usr/lib64/liblber-2.4.so.2.10.3
7f7b1356a000-7f7b13769000 ---p e000 00:10 136807348 
/usr/lib64/liblber-2.4.so.2.10.3
7f7b13769000-7f7b1376a000 r--p d000 00:10 136807348 
/usr/lib64/liblber-2.4.so.2.10.3
7f7b1376a000-7f7b1376b000 rw-p e000 00:10 136807348 
/usr/lib64/liblber-2.4.so.2.10.3
7f7b1376b000-7f7b13976000 r-xp  00:10 142872611 
/usr/lib64/libcrypto.so.1.0.0
7f7b13976000-7f7b13b75000 ---p 0020b000 00:10 142872611 
/usr/lib64/libcrypto.so.1.0.0
7f7b13b75000-7f7b13b91000 r--p 0020a000 00:10 142872611 
/usr/lib64/libcrypto.so.1.0.0
7f7b13b91000-7f7b13b9d000 rw-p 00226000 00:10 142872611 
/usr/lib64/libcrypto.so.1.0.0
7f7b13b9d000-7f7b13ba rw-p  00:00 0
7f7b13ba-7f7b13c08000 r-xp  00:10 142872612 
/usr/lib64/libssl.so.1.0.0
7f7b13c08000-7f7b13e08000 ---p 00068000 00:10 142872612 
/usr/lib64/libssl.so.1.0.0
7f7b13e08000-7f7b13e0d000 r--p 00068000 00:10 142872612 
/usr/lib64/libssl.so.1.0.0
7f7b13e0d000-7f7b13e14000 rw-p 0006d000 00:10 142872612 
/usr/lib64/libssl.so.1.0.0
7f7b13e14000-7f7b13e2f000 r-xp  00:10 91821790  
/usr/lib64/librtmp.so.1
7f7b13e2f000-7f7b1402e000 ---p 0001b000 00:10 91821790  
/usr/lib64/librtmp.so.1
7f7b1402e000-7f7b1402f000 r--p 0001a000 00:10 91821790  
/usr/lib64/librtmp.so.1
7f7b1402f000-7f7b1403 rw-p 0001b000 00:10 91821790  
/usr/lib64/librtmp.so.1
7f7b1403-7f7b14093000 r-xp  00:10 149049390 
/usr/lib64/libcurl.so.4.3.0
7f7b14093000-7f7b14292000 ---p 00063000 00:10 149049390 
/usr/lib64/libcurl.so.4.3.0
7f7b14292000-7f7b14294000 r--p 00062000 00:10 149049390 
/usr/lib64/libcurl.so.4.3.0
7f7b14294000-7f7b14295000 rw-p 

[Issue 14502] dmd -O optimization breaks app

2015-04-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #7 from Vladimir Panteleev thecybersha...@gmail.com ---
(In reply to Tomáš Chaloupka from comment #6)
 dustmite is problematic because it can lead to versions which segfaults too,
 but with other reason or which eats all mem, etc. And is slow as hell to
 test outputs from all variants (-O -release, -release, -debug) - I let it
 run for more than 24hours actually with just slightly shorter version..

Um, did you read the linked page?

Your test script should do the following:

1. Compile the program without -O
2. Run the program and check that it exits successfully. You can use timeout
and ulimit to limit how much time and memory the program can consume.
3. If the above program works fine, compile it again with -O
4. Run the program and checks that it crashes (or produces output different
from the first run)
5. If the first run was OK and the second run crashed, return 0 (you have
reproduced the bug). Otherwise, return 1

--


[Issue 14502] dmd -O optimization breaks app

2015-04-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #6 from Tomáš Chaloupka chalu...@gmail.com ---
dustmite is problematic because it can lead to versions which segfaults too,
but with other reason or which eats all mem, etc. And is slow as hell to test
outputs from all variants (-O -release, -release, -debug) - I let it run for
more than 24hours actually with just slightly shorter version..

So I tried manually compare version which works and version which don't and
made an attachment with failing version and with simplified patch to working
version.

Patch consists of 3 changes.
I would guess something with:
new BasicBlockEdge(... instead of just BasicBlockEdge(...

BasicBlockEdge is a struct

But don't understand internals of what new means for structs?

--


[Issue 14502] dmd -O optimization breaks app

2015-04-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #4 from Tomáš Chaloupka chalu...@gmail.com ---
Created attachment 1516
  -- https://issues.dlang.org/attachment.cgi?id=1516action=edit
version which fails

--


[Issue 14502] dmd -O optimization breaks app

2015-04-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #5 from Tomáš Chaloupka chalu...@gmail.com ---
Created attachment 1517
  -- https://issues.dlang.org/attachment.cgi?id=1517action=edit
patch with which its ok

--


[Issue 14502] dmd -O optimization breaks app

2015-04-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14502

--- Comment #1 from Tomáš Chaloupka chalu...@gmail.com ---
Its really hard for me (as a D noob) to dustmite something usable from this :(

The output from gdb is:
Program received signal SIGSEGV, Segmentation fault.
0x77aa5407 in object.TypeInfo_Class.getHash(const(void*)) () from
/opt/dmd-2.067/lib64/libphobos2.so.0.67
#0  0x77aa5407 in object.TypeInfo_Class.getHash(const(void*)) () from
/opt/dmd-2.067/lib64/libphobos2.so.0.67
#1  0x77ac371a in _aaInX () from
/opt/dmd-2.067/lib64/libphobos2.so.0.67
#2  0x77ac36d0 in _aaGetRvalueX () from
/opt/dmd-2.067/lib64/libphobos2.so.0.67
#3  0x00407bf8 in test.HavlakLoopFinder.DSF(test.BasicBlock,
test.UnionFindNode[], int[test.BasicBlock], int[], int) ()
#4  0x00407c48 in test.HavlakLoopFinder.DSF(test.BasicBlock,
test.UnionFindNode[], int[test.BasicBlock], int[], int) ()
#5  0x00407c48 in test.HavlakLoopFinder.DSF(test.BasicBlock,
test.UnionFindNode[], int[test.BasicBlock], int[], int) ()

It has deterministic behaviour, always segfaults on the 12th iteration.

I've made a PR https://github.com/kostya/benchmarks/pull/23
which ads final to classes to speed it up a bit and this problem no longer
occur with these changes - I have no idea why

--