Configure checks and optimizations/crc32 tests

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
Subject: Configure checks and optimizations/crc32 tests
Date: 2015-08-14 09:20:39
Message-ID: 20150814092039.GH4955@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

when building with optimizations clang-3.7, probably some older
compilers as well, fail with a funny error:

fatal error: error in backend: Cannot select: intrinsic %llvm.x86.sse42.crc32.64.64

turns out that is because configure chose to use the crc32 instruction,
without the according compiler -msse4.2 flag. Why you ask? Because the
whole configure test is optimized away. Nothing depends on it's
output...

We can easily fix the issue by adding
/* return values dependent on crc, to prevent optimizations */
return crc == 0;
or so to the end of PGAC_SSE42_CRC32_INTRINSICS.

But we've played that whack-a-mole game in a bunch of configure tests
now, and it seems likely that more are coming with compilers getting
better. I'd not be surprised if some tests actually always succeed, we
just don't notice it because it's only on new compilers that have the
tested feature anyway...

One way trying to fix this would be to explicitly disable optimizations
during tests. I'm not sure that's a good idea, but it's one.

Greetings,

Andres Freund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahul Majumdar/TVM/TCS 2015-08-14 09:32:36 query in PostgreSQL
Previous Message Andres Freund 2015-08-14 09:10:47 Re: replication slot restart_lsn initialization