Patchwork Fix float-cast test (PR testsuite/61319)

login
register
mail settings
Submitter Marek Polacek
Date May 27, 2014, 11:32 a.m.
Message ID <20140527113203.GK17600@redhat.com>
Download mbox | patch
Permalink /patch/352878/
State New
Headers show

Comments

Marek Polacek - May 27, 2014, 11:32 a.m.
E.g. CentOS 5 doesn't define several macros in limits.h, so define
them conditionally to make the test pass.

Ok for trunk?

2014-05-27  Marek Polacek  <polacek@redhat.com>

	PR testsuite/61319
	* c-c++-common/ubsan/float-cast.h: Conditionally define LLONG_MAX,
	LLONG_MIN, and ULLONG_MAX.


	Marek
Jakub Jelinek - May 27, 2014, 11:38 a.m.
On Tue, May 27, 2014 at 01:32:03PM +0200, Marek Polacek wrote:
> E.g. CentOS 5 doesn't define several macros in limits.h, so define
> them conditionally to make the test pass.
> 
> Ok for trunk?
> 
> 2014-05-27  Marek Polacek  <polacek@redhat.com>
> 
> 	PR testsuite/61319
> 	* c-c++-common/ubsan/float-cast.h: Conditionally define LLONG_MAX,
> 	LLONG_MIN, and ULLONG_MAX.

Ok, thanks.

	Jakub

Patch

diff --git gcc/testsuite/c-c++-common/ubsan/float-cast.h gcc/testsuite/c-c++-common/ubsan/float-cast.h
index 166da8f..e76171a 100644
--- gcc/testsuite/c-c++-common/ubsan/float-cast.h
+++ gcc/testsuite/c-c++-common/ubsan/float-cast.h
@@ -1,5 +1,16 @@ 
 /* Various macros for -fsanitize=float-cast-overflow testing.  */
 
+/* E.g. on CentOS 5 these aren't defined in limits.h.  */
+#ifndef LLONG_MAX
+# define LLONG_MAX __LONG_LONG_MAX__
+#endif
+#ifndef LLONG_MIN
+# define LLONG_MIN (-__LONG_LONG_MAX__ - 1LL)
+#endif
+#ifndef ULLONG_MAX
+# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
+#endif
+
 #define INT128_MAX (__int128) (((unsigned __int128) 1 << ((__SIZEOF_INT128__ * __CHAR_BIT__) - 1)) - 1)
 #define INT128_MIN (-INT128_MAX - 1)
 #define UINT128_MAX ((2 * (unsigned __int128) INT128_MAX) + 1)