re PR target/23139 (-pedantic -ffast-math breaks working code)

fixincludes:
	PR c++/23139
	* inclhack.def (huge_val_hex, huge_valf_hex, huge_vall_hex): New
	fixes.
	* fixincl.x: Regenerate.
	* tests/base/bits/huge_val.h: New file.

gcc/testsuite:
	* g++.dg/warn/huge-val1.C: New test.

From-SVN: r104315
This commit is contained in:
Joseph Myers 2005-09-15 20:09:27 +01:00 committed by Joseph Myers
parent 451e92db80
commit 77923c2938
6 changed files with 270 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2005-09-15 Joseph S. Myers <joseph@codesourcery.com>
PR c++/23139
* inclhack.def (huge_val_hex, huge_valf_hex, huge_vall_hex): New
fixes.
* fixincl.x: Regenerate.
* tests/base/bits/huge_val.h: New file.
2005-08-14 Kelley Cook <kcook@gcc.gnu.org>
* All files: Update with new FSF address.

View File

@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
* It has been AutoGen-ed Friday June 24, 2005 at 01:40:52 PM EDT
* It has been AutoGen-ed Thursday September 15, 2005 at 06:55:23 PM UTC
* From the definitions inclhack.def
* and the template file fixincl
*/
/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Jun 24 13:40:52 EDT 2005
/* DO NOT CVS-MERGE THIS FILE, EITHER Thu Sep 15 18:55:24 UTC 2005
*
* You must regenerate it. Use the ./genfixes script.
*
@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
* This file contains 190 fixup descriptions.
* This file contains 193 fixup descriptions.
*
* See README for more information.
*
@ -36,8 +36,8 @@
* You should have received a copy of the GNU General Public License
* along with inclhack. See the file "COPYING". If not,
* write to: The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * *
@ -2911,6 +2911,132 @@ static const char* apzHpux_SystimePatch[] = {
"struct sigevent;",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Huge_Val_Hex fix
*/
tSCC zHuge_Val_HexName[] =
"huge_val_hex";
/*
* File name selection pattern
*/
tSCC zHuge_Val_HexList[] =
"|bits/huge_val.h|";
/*
* Machine/OS name selection pattern
*/
#define apzHuge_Val_HexMachs (const char**)NULL
/*
* content selection pattern - do fix if pattern found
*/
tSCC zHuge_Val_HexSelect0[] =
"^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
/*
* content bypass pattern - skip fix if pattern found
*/
tSCC zHuge_Val_HexBypass0[] =
"__builtin_huge_val";
#define HUGE_VAL_HEX_TEST_CT 2
static tTestDesc aHuge_Val_HexTests[] = {
{ TT_NEGREP, zHuge_Val_HexBypass0, (regex_t*)NULL },
{ TT_EGREP, zHuge_Val_HexSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Huge_Val_Hex
*/
static const char* apzHuge_Val_HexPatch[] = {
"format",
"#define HUGE_VAL (__builtin_huge_val())\n",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Huge_Valf_Hex fix
*/
tSCC zHuge_Valf_HexName[] =
"huge_valf_hex";
/*
* File name selection pattern
*/
tSCC zHuge_Valf_HexList[] =
"|bits/huge_val.h|";
/*
* Machine/OS name selection pattern
*/
#define apzHuge_Valf_HexMachs (const char**)NULL
/*
* content selection pattern - do fix if pattern found
*/
tSCC zHuge_Valf_HexSelect0[] =
"^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
/*
* content bypass pattern - skip fix if pattern found
*/
tSCC zHuge_Valf_HexBypass0[] =
"__builtin_huge_valf";
#define HUGE_VALF_HEX_TEST_CT 2
static tTestDesc aHuge_Valf_HexTests[] = {
{ TT_NEGREP, zHuge_Valf_HexBypass0, (regex_t*)NULL },
{ TT_EGREP, zHuge_Valf_HexSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Huge_Valf_Hex
*/
static const char* apzHuge_Valf_HexPatch[] = {
"format",
"#define HUGE_VALF (__builtin_huge_valf())\n",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Huge_Vall_Hex fix
*/
tSCC zHuge_Vall_HexName[] =
"huge_vall_hex";
/*
* File name selection pattern
*/
tSCC zHuge_Vall_HexList[] =
"|bits/huge_val.h|";
/*
* Machine/OS name selection pattern
*/
#define apzHuge_Vall_HexMachs (const char**)NULL
/*
* content selection pattern - do fix if pattern found
*/
tSCC zHuge_Vall_HexSelect0[] =
"^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
/*
* content bypass pattern - skip fix if pattern found
*/
tSCC zHuge_Vall_HexBypass0[] =
"__builtin_huge_vall";
#define HUGE_VALL_HEX_TEST_CT 2
static tTestDesc aHuge_Vall_HexTests[] = {
{ TT_NEGREP, zHuge_Vall_HexBypass0, (regex_t*)NULL },
{ TT_EGREP, zHuge_Vall_HexSelect0, (regex_t*)NULL }, };
/*
* Fix Command Arguments for Huge_Vall_Hex
*/
static const char* apzHuge_Vall_HexPatch[] = {
"format",
"#define HUGE_VALL (__builtin_huge_vall())\n",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Int_Abort_Free_And_Exit fix
@ -7722,9 +7848,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
#define REGEX_COUNT 229
#define REGEX_COUNT 235
#define MACH_LIST_SIZE_LIMIT 261
#define FIX_COUNT 190
#define FIX_COUNT 193
/*
* Enumerate the fixes
@ -7798,6 +7924,9 @@ typedef enum {
HPUX_HTONL_FIXIDX,
HPUX_LONG_DOUBLE_FIXIDX,
HPUX_SYSTIME_FIXIDX,
HUGE_VAL_HEX_FIXIDX,
HUGE_VALF_HEX_FIXIDX,
HUGE_VALL_HEX_FIXIDX,
INT_ABORT_FREE_AND_EXIT_FIXIDX,
IO_QUOTES_DEF_FIXIDX,
IO_QUOTES_USE_FIXIDX,
@ -8263,6 +8392,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX_SYSTIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHpux_SystimeTests, apzHpux_SystimePatch, 0 },
{ zHuge_Val_HexName, zHuge_Val_HexList,
apzHuge_Val_HexMachs,
HUGE_VAL_HEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHuge_Val_HexTests, apzHuge_Val_HexPatch, 0 },
{ zHuge_Valf_HexName, zHuge_Valf_HexList,
apzHuge_Valf_HexMachs,
HUGE_VALF_HEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHuge_Valf_HexTests, apzHuge_Valf_HexPatch, 0 },
{ zHuge_Vall_HexName, zHuge_Vall_HexList,
apzHuge_Vall_HexMachs,
HUGE_VALL_HEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHuge_Vall_HexTests, apzHuge_Vall_HexPatch, 0 },
{ zInt_Abort_Free_And_ExitName, zInt_Abort_Free_And_ExitList,
apzInt_Abort_Free_And_ExitMachs,
INT_ABORT_FREE_AND_EXIT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,

View File

@ -1680,6 +1680,54 @@ fix = {
};
/*
* Fix glibc definition of HUGE_VAL in terms of hex floating point constant
*/
fix = {
hackname = huge_val_hex;
files = bits/huge_val.h;
select = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
bypass = "__builtin_huge_val";
c_fix = format;
c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n";
test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
};
/*
* Fix glibc definition of HUGE_VALF in terms of hex floating point constant
*/
fix = {
hackname = huge_valf_hex;
files = bits/huge_val.h;
select = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
bypass = "__builtin_huge_valf";
c_fix = format;
c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n";
test_text = "# define HUGE_VALF (__extension__ 0x1.0p255f)";
};
/*
* Fix glibc definition of HUGE_VALL in terms of hex floating point constant
*/
fix = {
hackname = huge_vall_hex;
files = bits/huge_val.h;
select = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
bypass = "__builtin_huge_vall";
c_fix = format;
c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n";
test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)";
};
/*
* Fix return type of abort and free
*/

View File

@ -0,0 +1,27 @@
/* DO NOT EDIT THIS FILE.
It has been auto-edited by fixincludes from:
"fixinc/tests/inc/bits/huge_val.h"
This had to be done to correct non-standard usages in the
original, manufacturer supplied header file. */
#if defined( HUGE_VAL_HEX_CHECK )
#define HUGE_VAL (__builtin_huge_val())
#endif /* HUGE_VAL_HEX_CHECK */
#if defined( HUGE_VALF_HEX_CHECK )
#define HUGE_VALF (__builtin_huge_valf())
#endif /* HUGE_VALF_HEX_CHECK */
#if defined( HUGE_VALL_HEX_CHECK )
#define HUGE_VALL (__builtin_huge_vall())
#endif /* HUGE_VALL_HEX_CHECK */

View File

@ -1,3 +1,8 @@
2005-09-15 Joseph S. Myers <joseph@codesourcery.com>
PR c++/23139
* g++.dg/warn/huge-val1.C: New test.
2005-09-15 Mark Mitchell <mark@codesourcery.com>
PR c++/13140

View File

@ -0,0 +1,31 @@
// PR c++/23139: HUGE_VAL definition should be accepted with -pedantic.
// Origin: Joseph Myers <joseph@codesourcery.com>
// { dg-do link }
// { dg-options "-pedantic-errors" }
#include <math.h>
double d = HUGE_VAL;
#ifdef HUGE_VALF
float f = HUGE_VALF;
#endif
#ifdef HUGE_VALL
long double l = HUGE_VALL;
#endif
extern void link_failure ();
int
main ()
{
if (HUGE_VAL != __builtin_huge_val ())
link_failure ();
#ifdef HUGE_VALF
if (HUGE_VALF != __builtin_huge_valf ())
link_failure ();
#endif
#ifdef HUGE_VALL
if (HUGE_VALL != __builtin_huge_vall ())
link_failure ();
#endif
}