Bug 1507 – ICE on a variadic function

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-09-16T17:21:00Z
Last change time
2015-06-09T05:14:58Z
Assigned to
dvdfrdmn
Creator
onlystupidspamhere

Attachments

IDFilenameSummaryContent-TypeSize
183backtrace.txtbacktrace of the issuetext/plain4683

Comments

Comment #0 by onlystupidspamhere — 2007-09-16T17:21:52Z
This is a simplified piece of code from Tango that segfaults the compiler (I also tested rev 159) and thus prevents using Tango: void c (int f, ...) { c (_arguments, _argptr, f); } Compiler output: $ gdc -c -v bug.d Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ./configure --prefix=/usr/local/gcc-4.1.2 --enable-languages=c,d --disable-multilib Thread model: posix gcc version 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) /usr/local/gcc-4.1.2/libexec/gcc/x86_64-unknown-linux-gnu/4.1.2/cc1d bug.d -quiet -dumpbase bug.d -mtune=k8 -auxbase bug -version -o /tmp/ccTUEx8A.s GNU D version 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 bug.d:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment #1 by dvdfrdmn — 2007-09-16T21:03:50Z
Can you provide a self-contained example? Thanks.
Comment #2 by braddr — 2007-09-16T22:57:40Z
Jari-Matti, I just tried the one line'er you included in the original report: void c (int f, ...) { c (_arguments, _argptr, f); } as bug.d with gdc built as debian package 4.1.2-16, which contains up through this set of bug fixes (it doesn't mention the specific svn revision): gdc-4.1 (0.24-4.1.2-16) unstable; urgency=low * Merge debian SVN from 4.1.2-16 upload [Arthur Loiret] * svn-gdc-updates.dpatch: Update to SVN 20070829. Closes: #439836 - d-decls.cc (uniqueName): Allow multiple static declaration with the same name if in a function. (SF 1783085) - d-codegen.cc (call): Use CommaExp correctly. (Bugzilla 1443) - dmd/todt.c (createTsarrayDt): Don't take quadratic time to build the initializer. (Bugzilla 1440) [Matthias Klose] * gdc-4.1: Loosen dependency on g++-4.1. -- Arthur Loiret <[email protected]> Sat, 01 Sep 2007 00:49:23 +0200 ---------------- It fails to build, but due to errors in the provided one line bit of code: bug.d:1: function bug.c (int,...) does not match parameter types (TypeInfo[],char*,int) bug.d:1: Error: cannot implicitly convert expression (_arguments) of type TypeInfo[] to int ---- Is that the exact code that caused your failure?
Comment #3 by onlystupidspamhere — 2007-09-17T05:42:13Z
(In reply to comment #2) > Jari-Matti, I just tried the one line'er you included in the original report: > > void c (int f, ...) { c (_arguments, _argptr, f); } > > as bug.d with gdc built as debian package 4.1.2-16, which contains up through > this set of bug fixes (it doesn't mention the specific svn revision): > > gdc-4.1 (0.24-4.1.2-16) unstable; urgency=low > > * Merge debian SVN from 4.1.2-16 upload > > [Arthur Loiret] > * svn-gdc-updates.dpatch: Update to SVN 20070829. Closes: #439836 > - d-decls.cc (uniqueName): Allow multiple static declaration with the same > name if in a function. (SF 1783085) > - d-codegen.cc (call): Use CommaExp correctly. (Bugzilla 1443) > - dmd/todt.c (createTsarrayDt): Don't take quadratic time to build the > initializer. (Bugzilla 1440) > > [Matthias Klose] > * gdc-4.1: Loosen dependency on g++-4.1. > > -- Arthur Loiret <[email protected]> Sat, 01 Sep 2007 00:49:23 +0200 Ok, so your version is at least rev149. Are you running it in x86-64? I can post here my installation notes if it helps: tar xf gcc-core-4.1.2.tar.bz2 svn co https://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/ svn cd gcc-4.1.2/gcc/ ln -s ../../svn/d . cd .. gcc/d/setup-gcc.sh ./configure --prefix=/usr/local/gcc-4.1.2 --enable-languages=c,d --disable-multilib make -j3 sudo make install echo "void c (int f, ...) { c (_arguments, _argptr, f); }" > bug.d /usr/local/gcc-4.1.2/bin/gdc -c bug.d => segmentation fault > It fails to build, but due to errors in the provided one line bit of code: > > bug.d:1: function bug.c (int,...) does not match parameter types > (TypeInfo[],char*,int) > bug.d:1: Error: cannot implicitly convert expression (_arguments) of type > TypeInfo[] to int Yes, the code in invalid so that is what I get with dmd too. I seem to have problems compiling 32bit GDC so I can only test x86_64 -version at the moment. I have no idea how to debug gdc - e.g. gdb gave no backtrace. > Is that the exact code that caused your failure? Yes. I tried it again by just copying the line from the bug report to a file and compiling it. I'll try to run GDC in a Gentoo virtual machine later today to see if it fails there too.
Comment #4 by onlystupidspamhere — 2007-09-17T08:20:28Z
Created attachment 183 backtrace of the issue Here's a backtrace of the issue. Please ask, if you need more detailed info.
Comment #5 by dvdfrdmn — 2007-09-23T16:48:55Z
The ICE is fixed in svn rev 163. Tango does not build on AMD64 because it assumes va_list is a pointer. This will be handled as a separate issue.
Comment #6 by dvdfrdmn — 2007-10-13T15:27:31Z
*** Bug 1572 has been marked as a duplicate of this bug. ***
Comment #7 by pop.atry — 2007-10-23T02:05:44Z
*** Bug 1607 has been marked as a duplicate of this bug. ***