Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 39 - gdmd segfault during compilation of simple matrix multiplication routine
Summary: gdmd segfault during compilation of simple matrix multiplication routine
Status: RESOLVED INVALID
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 4.7.x
Hardware: x86_64 Linux
: --- critical
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2013-03-06 06:28 CET by J
Modified: 2014-01-12 11:11 CET (History)
1 user (show)

See Also:


Attachments
source code that induces gdmd to segfault (2.20 KB, application/octet-stream)
2013-03-06 06:28 CET, J
Details

Note You need to log in before you can comment on or make changes to this bug.
Description J 2013-03-06 06:28:34 CET
Created attachment 33 [details]
source code that induces gdmd to segfault

See the attached source file for a simple matrix multiplication test. When attempting to compile on linux with gdmd, the compiler segfaults.  The gdc compiler should complain if it doesn't like the code, but it should never itself segfault.

On OS: Ubuntu 10.04
$ uname -a
Linux hotbox 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37 UTC 2010 x86_64 GNU/Linux

On GDC: built atop gcc 4.7.2.
$ gdmd -v
gdc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Specific source version of GDC as pulled from git: (on branch 4.7.2)
~/pkg/gdc/GDC$ git log|head
commit b8f5c22b0e7afa7e68a287ed788597e783540063
Merge: d4936c9 84d02ef
Author: Iain Buclaw <ibuclaw@ubuntu.com>
Date:   Sun Feb 24 06:46:00 2013 -0800

    Merge pull request #51 from jpf91/gdc-4.7

    Update gdc-4.7 branch

commit 84d02efb3f0d608935dc98114a2c3cec6433c94a

~/pkg/gdc/GDC$ git branch -v
* gdc-4.7 b8f5c22 Merge pull request #51 from jpf91/gdc-4.7
  master  465c7cc Handle use cases of @attribute foo, and @attribute(null) foo.
~/pkg/gdc/GDC$ 

result of running attached source:
$ gdmd gdmd_segfault.d
gdmd_segfault.d: In function ‘scid_matrix_test.mmult’:
gdmd_segfault.d:76: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 J 2013-03-06 06:42:42 CET
gdb stack trace to help localize the problem:

$gdb gdc
(gdb) # have to follow the child process or we aren't tracing the process that crashes:
(gdb) set follow-fork-mode child
(gdb) set args gdmd_segfault.d
(gdb) run

Program received signal SIGSEGV, Segmentation fault.
[Switching to process 3621]
0x0000000000b20d9d in useless_type_conversion_p ()
(gdb) bt
#0  0x0000000000b20d9d in useless_type_conversion_p ()
#1  0x0000000000b215bd in tree_ssa_useless_type_conversion ()
#2  0x0000000000b215ec in tree_ssa_strip_useless_type_conversions ()
#3  0x000000000082484d in gimplify_expr ()
#4  0x0000000000821bc4 in gimplify_stmt ()
#5  0x0000000000819225 in gimplify_statement_list ()
#6  0x0000000000825a38 in gimplify_expr ()
#7  0x0000000000821bc4 in gimplify_stmt ()
#8  0x000000000081717a in gimplify_and_add ()
#9  0x0000000000819138 in gimplify_loop_expr ()
#10 0x00000000008251bb in gimplify_expr ()
#11 0x0000000000821bc4 in gimplify_stmt ()
#12 0x0000000000819225 in gimplify_statement_list ()
#13 0x0000000000825a38 in gimplify_expr ()
#14 0x0000000000821bc4 in gimplify_stmt ()
#15 0x000000000081717a in gimplify_and_add ()
#16 0x0000000000819138 in gimplify_loop_expr ()
#17 0x00000000008251bb in gimplify_expr ()
#17 0x00000000008251bb in gimplify_expr ()
#18 0x0000000000821bc4 in gimplify_stmt ()
#19 0x0000000000819225 in gimplify_statement_list ()
#20 0x0000000000825a38 in gimplify_expr ()
#21 0x0000000000821bc4 in gimplify_stmt ()
#22 0x000000000081717a in gimplify_and_add ()
#23 0x0000000000819138 in gimplify_loop_expr ()
#24 0x00000000008251bb in gimplify_expr ()
#25 0x0000000000821bc4 in gimplify_stmt ()
#26 0x0000000000819225 in gimplify_statement_list ()
#27 0x0000000000825a38 in gimplify_expr ()
#28 0x0000000000821bc4 in gimplify_stmt ()
#29 0x0000000000818866 in gimplify_bind_expr ()
#30 0x000000000082519a in gimplify_expr ()
#31 0x0000000000821bc4 in gimplify_stmt ()
#32 0x0000000000826ff6 in gimplify_body ()
#33 0x000000000082746f in gimplify_function_tree ()
#34 0x00000000006da80a in cgraph_analyze_function ()
#35 0x00000000006dae62 in cgraph_analyze_functions ()
#36 0x00000000006db669 in cgraph_finalize_compilation_unit ()
#37 0x0000000000622522 in d_write_global_declarations() ()
#38 0x00000000009c2241 in compile_file ()
#39 0x00000000009c437c in do_compile ()
#40 0x00000000009c44e7 in toplev_main ()
#41 0x000000000066be44 in main ()
(gdb)
Comment 2 Iain Buclaw 2013-03-06 08:45:39 CET
Please include all files related to the bug, or reduce your testcase down further.

Thanks
Iain
Comment 3 Johannes Pfau 2014-01-12 11:11:29 CET
Need a working test case first, I don't even know where the correct/maintained version of scid is hosted now.

There have been two frontend releases since this bug report and lots of backend work so chances are it's fixed.

If you can still reproduce this error with a recent GCC (master/gdc-4.8 branch) feel free to reopen this bug report, but please provide a reduced (use dustmite[1]) or at least complete (zip file including all .d files, especially scid) test case.

[1] https://github.com/CyberShadow/DustMite