public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34086]  New: g++ crashes on simple 20-line source file
@ 2007-11-13 20:12 nmaquet at gmail dot com
  2007-11-13 20:13 ` [Bug c++/34086] " nmaquet at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: nmaquet at gmail dot com @ 2007-11-13 20:12 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2993 bytes --]

The following code crashes g++ 4.1.3 :


*********START OF FILE**************

#include <iostream>
using namespace std;

double arctan(double x)
{
   int i=1,n=20;
   double c=1.0,arct=0.0,paf=1.0,eps=0.00001,hab;
   hab=(x/(1+x*x));
   do
       {
           arct+=paf;
           c+=2i/(2i+1);
           paf=(c*hab);
           i++;
       }
   while((i<n)||(paf>eps));
   arct*=hab;
   return arct;
}

int main()
{
   double Pi;
   Pi=4*(4*arctan(1/5)-arctan(1/239));
   cout<<Pi<<endl;
}

********* END OF FILE **************

And here's the output of g++ :

nmaquet@nmaquet-desktop:/tmp$ g++ -v test.cpp
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
 /usr/lib/gcc/i486-linux-gnu/4.1.3/cc1plus -quiet -v -D_GNU_SOURCE test.cpp
-quiet -dumpbase test.cpp -mtune=generic -auxbase test -version
-fstack-protector -fstack-protector -o /tmp/ccQX7fQO.s
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.1.3
 /usr/include/c++/4.1.3/i486-linux-gnu
 /usr/include/c++/4.1.3/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.1.3/include
 /usr/include
End of search list.
GNU C++ version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
(i486-linux-gnu)
        compiled by GNU C version 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3cc47be363985179cfafdceddd0e8f5d
test.cpp: In function ‘double arctan(double)’:
test.cpp:12: internal compiler error: in const_binop, at fold-const.c:1641
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/cczf63dY.out file, please attach this to
your bugreport.


-- 
           Summary: g++ crashes on simple 20-line source file
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nmaquet at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/34086] g++ crashes on simple 20-line source file
  2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
@ 2007-11-13 20:13 ` nmaquet at gmail dot com
  2007-11-13 20:16 ` nmaquet at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nmaquet at gmail dot com @ 2007-11-13 20:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from nmaquet at gmail dot com  2007-11-13 20:13 -------
Created an attachment (id=14547)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14547&action=view)
preprocessed source


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/34086] g++ crashes on simple 20-line source file
  2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
  2007-11-13 20:13 ` [Bug c++/34086] " nmaquet at gmail dot com
@ 2007-11-13 20:16 ` nmaquet at gmail dot com
  2007-11-13 21:12 ` fang at csl dot cornell dot edu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nmaquet at gmail dot com @ 2007-11-13 20:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from nmaquet at gmail dot com  2007-11-13 20:16 -------
I reported this on Launchpad a few weeks ago but it doesn't get much attention
:

https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/155259


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/34086] g++ crashes on simple 20-line source file
  2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
  2007-11-13 20:13 ` [Bug c++/34086] " nmaquet at gmail dot com
  2007-11-13 20:16 ` nmaquet at gmail dot com
@ 2007-11-13 21:12 ` fang at csl dot cornell dot edu
  2007-11-13 22:38 ` [Bug c++/34086] [4.1 Regression] " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fang at csl dot cornell dot edu @ 2007-11-13 21:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fang at csl dot cornell dot edu  2007-11-13 21:12 -------
4.0.1 (apple) ICEs:
pr34086.cc: In function 'double arctan(double)':
pr34086.cc:12: internal compiler error: in const_binop, at fold-const.c:1610

4.2.2 gives me:
pr34086.cc: In function 'double arctan(double)':
pr34086.cc:12: error: cannot convert 'double __complex__' to 'double' in
assignment


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/34086] [4.1 Regression] g++ crashes on simple 20-line source file
  2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
                   ` (2 preceding siblings ...)
  2007-11-13 21:12 ` fang at csl dot cornell dot edu
@ 2007-11-13 22:38 ` rguenth at gcc dot gnu dot org
  2007-11-19  5:20 ` pinskia at gcc dot gnu dot org
  2008-07-04 16:17 ` jsm28 at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-13 22:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2007-11-13 22:38 -------
Confirmed.

#1  0x084a545e in const_binop (code=TRUNC_DIV_EXPR, arg1=0xb7cec528, 
    arg2=0xb7cec720, notrunc=0)
    at /home/richard/src/gcc-4_1-branch/gcc/fold-const.c:1640
1640            default:
(gdb) l
1635                real = const_binop (code, t1, magsquared, notrunc);
1636                imag = const_binop (code, t2, magsquared, notrunc);
1637              }
1638              break;
1639
1640            default:
1641              gcc_unreachable ();
1642            }
1643
1644          if (real && imag)

both args are COMPLEX_CST which are not valid for TRUNC_DIV_EXPR.

#1  0x084a545e in const_binop (code=TRUNC_DIV_EXPR, arg1=0xb7cec528, 
    arg2=0xb7cec720, notrunc=0)
    at /home/richard/src/gcc-4_1-branch/gcc/fold-const.c:1640
#2  0x084d63be in fold_binary (code=TRUNC_DIV_EXPR, type=0xb7cea844, 
    op0=0xb7cec528, op1=0xb7cec720)
    at /home/richard/src/gcc-4_1-branch/gcc/fold-const.c:7626
#3  0x084f4704 in fold (expr=0xb7c4d2ac)
    at /home/richard/src/gcc-4_1-branch/gcc/fold-const.c:10303
#4  0x081e0b06 in fold_if_not_in_template (expr=0xb7c4d2ac)
    at /home/richard/src/gcc-4_1-branch/gcc/cp/tree.c:2334
#5  0x0818c0cb in build_binary_op (code=TRUNC_DIV_EXPR, orig_op0=0xb7cec528, 
    orig_op1=0xb7cec720, convert_p=1)
    at /home/richard/src/gcc-4_1-branch/gcc/cp/typeck.c:3594
#6  0x080576d7 in build_new_op (code=TRUNC_DIV_EXPR, flags=3, arg1=0xb7cec528, 
    arg2=0xb7cec720, arg3=0x0, overloaded_p=0xbfc21583 "")
    at /home/richard/src/gcc-4_1-branch/gcc/cp/call.c:3914
#7  0x08188321 in build_x_binary_op (code=TRUNC_DIV_EXPR, arg1=0xb7cec528, 
    arg2=0xb7cec720, overloaded_p=0xbfc21583 "")
    at /home/richard/src/gcc-4_1-branch/gcc/cp/typeck.c:2778

Indeed a C++ frontend issue and a regression from 3.4.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
      Known to fail|                            |4.0.4 4.1.3
      Known to work|                            |4.2.2 3.4.6
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-13 22:38:08
               date|                            |
            Summary|g++ crashes on simple 20-   |[4.1 Regression] g++ crashes
                   |line source file            |on simple 20-line source
                   |                            |file


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/34086] [4.1 Regression] g++ crashes on simple 20-line source file
  2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
                   ` (3 preceding siblings ...)
  2007-11-13 22:38 ` [Bug c++/34086] [4.1 Regression] " rguenth at gcc dot gnu dot org
@ 2007-11-19  5:20 ` pinskia at gcc dot gnu dot org
  2008-07-04 16:17 ` jsm28 at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-19  5:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.1.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/34086] [4.1 Regression] g++ crashes on simple 20-line source file
  2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
                   ` (4 preceding siblings ...)
  2007-11-19  5:20 ` pinskia at gcc dot gnu dot org
@ 2008-07-04 16:17 ` jsm28 at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 16:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2008-07-04 16:16 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34086


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-04 16:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-13 20:12 [Bug c++/34086] New: g++ crashes on simple 20-line source file nmaquet at gmail dot com
2007-11-13 20:13 ` [Bug c++/34086] " nmaquet at gmail dot com
2007-11-13 20:16 ` nmaquet at gmail dot com
2007-11-13 21:12 ` fang at csl dot cornell dot edu
2007-11-13 22:38 ` [Bug c++/34086] [4.1 Regression] " rguenth at gcc dot gnu dot org
2007-11-19  5:20 ` pinskia at gcc dot gnu dot org
2008-07-04 16:17 ` jsm28 at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).