This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp] Fix mkomp_h.pl
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Diego Novillo <dnovillo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Oct 2005 17:12:02 -0400
- Subject: [gomp] Fix mkomp_h.pl
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The reason why openmpbench_F_v2 got stuck in syncbench at -O0 is
that since the Sep, 30th we generate wrong omp.h, omp_lib.h,
omp_lib.f90 etc.
That's because if configure sees that -pthread works, it will
add -Wc,-pthread to the flags. That's to workaround libtool
issues and libtool eats it, but mkomp_h.pl invokes the compiler
directly without the libtool wrapper.
The result of this was that all the replacements mkomp_h.pl
did were putting 1 into the headers/module, which means that
the lock variable was 1) small 2) misaligned.
The following patch just eats it from the command line,
plus adds a compile time check that mkomp_h.pl computed the
correct values.
Ok for gomp?
2005-10-27 Jakub Jelinek <jakub@redhat.com>
* mkomp_h.pl: Remove all -Wc, option prefixes in $COMPILE.
* libgomp_f.h.in (omp_check_defines): New function.
* env.c: Include libgomp_f.h.
(initialize_env): Call omp_check_defines.
--- libgomp/mkomp_h.pl.jj 2005-09-20 10:25:17.000000000 +0200
+++ libgomp/mkomp_h.pl 2005-10-27 22:50:49.000000000 +0200
@@ -36,6 +36,9 @@ $OUTFILE = $ARGV[2];
$HEADER = "#include \"omp-lock.h\"\n";
+# configure might put libtool specific options into $COMPILE.
+$COMPILE =~ s/ -Wc,/ /g;
+
# Close stderr in order to discard compiler errors. Which we expect apleanty.
close STDERR;
--- libgomp/libgomp_f.h.in.jj 2005-09-20 10:25:17.000000000 +0200
+++ libgomp/libgomp_f.h.in 2005-10-27 23:01:59.000000000 +0200
@@ -59,4 +59,16 @@ typedef union { omp_nest_lock_t *lock; u
# define omp_nest_lock_arg(arg) ((arg)->lock)
# endif
+static inline void
+omp_check_defines (void)
+{
+ char test[(OMP_LOCK_SIZE != sizeof (omp_lock_t)
+ || OMP_LOCK_ALIGN != __alignof (omp_lock_t)
+ || OMP_NEST_LOCK_SIZE != sizeof (omp_nest_lock_t)
+ || OMP_NEST_LOCK_ALIGN != __alignof (omp_nest_lock_t)
+ || OMP_LOCK_KIND != sizeof (*(omp_lock_arg_t) 0)
+ || OMP_NEST_LOCK_KIND != sizeof (*(omp_nest_lock_arg_t) 0))
+ ? -1 : 1] __attribute__ ((__unused__));
+}
+
#endif /* LIBGOMP_F_H */
--- libgomp/env.c.jj 2005-06-14 00:13:10.000000000 +0200
+++ libgomp/env.c 2005-10-27 22:59:07.000000000 +0200
@@ -29,6 +29,7 @@
for them to be initialized from environment variables at startup. */
#include "libgomp.h"
+#include "libgomp_f.h"
#include <stdlib.h>
#include <string.h>
@@ -146,6 +147,9 @@ parse_boolean (const char *name, bool *v
static void __attribute__((constructor))
initialize_env (void)
{
+ /* Do a compile time check that mkomp_h.pl did good job. */
+ omp_check_defines ();
+
parse_schedule ();
parse_boolean ("OMP_DYNAMIC", &gomp_dyn_var);
parse_boolean ("OMP_NESTED", &gomp_nest_var);
Jakub