From 393a060a9e59d388ab84532bace4d5d418c2a5a7 Mon Sep 17 00:00:00 2001 From: jasonmoxham Date: Sat, 9 Jun 2012 06:52:30 +0000 Subject: [PATCH] do a proper test for bad gcc-4.3.2 --- acinclude.m4 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3ae1ec55..ff5e51d7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -482,14 +482,25 @@ GMP_PROG_CC_WORKS_PART([$1], []) GMP_PROG_CC_WORKS_PART_MAIN([$1], [gcc-4.3.2 on 64bit is bad], [/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */ -int main(){ -#ifdef __GNUC__ -#if __GNUC__ == 4 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ == 2 -int *p; -if(sizeof(p)==8)abort(); +#if defined(__GNUC__) +int __attribute__((noinline)) +foo(int i) +{ + int *p = __builtin_malloc (4 * sizeof(int)); + *p = 0; + p[i] = 1; + return *p; +} +extern void abort (void); +int main() +{ + if (foo(0) != 1) + abort (); + return 0; +} +#else +int main(){return 0;} #endif -#endif -return 0;} ]) GMP_PROG_CC_WORKS_PART([$1], [function pointer return],