Bug 49120

Summary: C++ code including <complex> fails when using -pedantic due to hypot redeclaration.
Product: [Retired] Red Hat Linux Reporter: Mumit Khan <khan>
Component: libstdc++Assignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-03-08 13:49:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
C++ <complex> hypot bug description, with preprocessed source. none

Description Mumit Khan 2001-07-14 00:27:23 UTC
Bug details:
============

Even the most trivial C++ program that includes <complex> fails to compile
in combination with -pedantic due to conflicting declaration of hypot().

System and GCC RPM information
===============================
$ cat /etc/issue
Red Hat Linux release 7.1 (Seawolf)
Kernel 2.4.3-12 on an i686

[ All packages up-to-date as of 2001-07-12 using up2date ]

$ rpm -qa|grep gcc
gcc-objc-2.96-85
gcc-2.96-85
gcc-g77-2.96-85
gcc-c++-2.96-85
gcc-chill-2.96-85
gcc-java-2.96-85
$ rpm -qa|grep libstdc++
libstdc++-2.96-85
libstdc++-devel-2.96-85
 
Source
======
$ cat hypot-bug.cc
#include <complex>

 
Compiler invocation and error output
====================================
 
$ gcc -c -v -save-temps -pedantic hypot-bug.cc
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2
-D__EXCEPTIONS -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0
-D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D__NO_INLINE__ -pedantic -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ hypot-bug.cc
hypot-bug.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (i386
Linux/ELF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-3
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus hypot-bug.ii -quiet
-dumpbase hypot-bug.cc -pedantic -version -o hypot-bug.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
(i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux
7.1 2.96-85).
In file included from /usr/include/g++-3/complex:7,
                 from hypot-bug.cc:1:
/usr/include/g++-3/std/complext.h:314: declaration of `double hypot
(double, double)' throws different exceptions
/usr/include/bits/mathcalls.h:150: than previous declaration `double
hypot (double, double) throw ()'

Comment 1 Mumit Khan 2001-07-14 00:28:45 UTC
Created attachment 23587 [details]
C++ <complex> hypot bug description, with preprocessed source.

Comment 2 Jakub Jelinek 2001-07-17 07:49:56 UTC
Will be fixed in libstdc++-devel-2.96-95 (is already in my tree).

Comment 3 Miloslav Trmac 2004-03-08 13:49:36 UTC
Fix confirmed in libstdc++-3.3.2-1.