| View previous topic :: View next topic |
| Author |
Message |
Brad Viviano
Joined: 05 Apr 2005 Posts: 9
|
Posted: Tue Mar 12, 2013 11:36 am Post subject: |
|
|
Hi Mat,
I took the piece of code that is in the configure script on which the failure of the offsetof macro occurs and tried to compile it with pgcc version 13.2
| Code: | #include <stddef.h>
int main ()
{
struct foo { int a, b;};
size_t offset = offsetof(struct foo, b);
return 0;
}
|
| Code: | | pgcc -c -DNDEBUG -g offsetof.c |
and I get the same errors that are logged in the config.log
| Quote: | PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (offsetof.c: 7)
PGC-S-0039-Use of undeclared variable foo (offsetof.c: 7)
PGC-S-0039-Use of undeclared variable b (offsetof.c: 7)
PGC/x86-64 Linux 13.2-0: compilation completed with severe errors
|
Do you have the same experience on an x86_64 CentOS 6.3 box?
Thanks |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Tue Mar 12, 2013 2:20 pm Post subject: |
|
|
Hi Brad,
I'm able to compile the code on every system I test here, but I don't have CentOS 6.3 installed anywhere (we don't officially support CentOS). So I'm not sure if this is a problem specific to your system or a problem with CentOS 6.3. I've asked our IT folk to get it installed on a VM.
The definition of offsetof comes from the GNU "stddef.h" file and should be defined as:
| Code: | | #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) |
We provide another "/opt/pgi/linux86-64/13.2/include/stddef.h" which defines "__builtin_offsetof" to be:
| Code: | | #define __builtin_offsetof(typ, fld) ((int)(&(((typ*)0)->fld))) |
Can you compile with "-P" (preprocess only) and then post the resulting ".i" file. This will tell us if its a problem with our header file or GNU has changed there definition.
- Mat |
|
| Back to top |
|
 |
Brad Viviano
Joined: 05 Apr 2005 Posts: 9
|
Posted: Wed Mar 13, 2013 6:10 am Post subject: |
|
|
Hi Mat,
I compiled the snippet of code I have saved in offsetof.c with the -P flag
| Code: | | pgcc -P -c -DNDEBUG -g offsetof.c |
Here is the resulting offsetof.i file
| Code: | typedef long int ptrdiff_t ;
typedef unsigned long int size_t ;
typedef int wchar_t ;
int main ( )
{
struct foo { int a , b ; } ;
size_t offset = __builtin_offsetof ( struct foo , b ) ;
;
return 0 ;
} |
|
|
| Back to top |
|
 |
Brad Viviano
Joined: 05 Apr 2005 Posts: 9
|
Posted: Wed Mar 13, 2013 6:20 am Post subject: |
|
|
Hey Mat,
I just tried to verify this
| Quote: |
We provide another "/opt/pgi/linux86-64/13.2/include/stddef.h" which defines "__builtin_offsetof" to be:
|
But I could only find stddef.h under
| Code: | | /opt/pgi/linux86/13.2/include/ | I couldn't find one under
| Code: | | /opt/pgi/linux86-64/13.2/include |
and this is an x86_64 box. Not sure if this means anything.
Thanks |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Wed Mar 13, 2013 8:47 am Post subject: |
|
|
Ok, so this is mostly likely the problem as the 64-bit directory should have a "stddef.h". Most likely the installer isn't recognizing your OS and it's not putting the header file in our include directory.
Can you add the following stddef.h to your installation and see if it works around the issue?
| Code: | /*
* stddef.h
*
* Copyright 2005, STMicroelectronics, Incorporated.
* All rights reserved.
*
* STMICROELECTRONICS, INCORPORATED PROPRIETARY INFORMATION
* This software is supplied under the terms of a license agreement
* or nondisclosure agreement with STMicroelectronics and may not be
* copied or disclosed except in accordance with the terms of that
* agreement.
*/
#include_next <stddef.h>
#ifdef __builtin_offsetof
#undef __builtin_offsetof
#endif
#define __builtin_offsetof(typ, fld) ((int)(&(((typ*)0)->fld)))
|
Thanks,
Mat |
|
| Back to top |
|
 |
|