www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1507] New: ICE on a variadic function

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507

           Summary: ICE on a variadic function
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: onlystupidspamhere yahoo.se


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.


-- 
Sep 16 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
            Summary|ICE on a variadic function  |ICE on a variadic function





Can you provide a self-contained example?  Thanks.


-- 
Sep 16 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507






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]

    - 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 <arthur.loiret gmail.com>  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?


-- 
Sep 16 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507







 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]

     - 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 <arthur.loiret gmail.com>  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. --
Sep 17 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507






Created an attachment (id=183)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=183&action=view)
backtrace of the issue

Here's a backtrace of the issue. Please ask, if you need more detailed info.


-- 
Sep 17 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED





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.


-- 
Sep 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang davidb.org





*** Bug 1572 has been marked as a duplicate of this bug. ***


-- 
Oct 13 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1507


pop.atry gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pop.atry gmail.com





*** Bug 1607 has been marked as a duplicate of this bug. ***


-- 
Oct 23 2007