PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

PGI 13.2 and openmpi 1.6.4
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Brad Viviano



Joined: 05 Apr 2005
Posts: 9

PostPosted: Tue Mar 12, 2013 11:36 am    Post subject: Reply with quote

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
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6206
Location: The Portland Group Inc.

PostPosted: Tue Mar 12, 2013 2:20 pm    Post subject: Reply with quote

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
View user's profile
Brad Viviano



Joined: 05 Apr 2005
Posts: 9

PostPosted: Wed Mar 13, 2013 6:10 am    Post subject: Reply with quote

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
View user's profile
Brad Viviano



Joined: 05 Apr 2005
Posts: 9

PostPosted: Wed Mar 13, 2013 6:20 am    Post subject: Reply with quote

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
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6206
Location: The Portland Group Inc.

PostPosted: Wed Mar 13, 2013 8:47 am    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group