Open PHHargrove opened 5 years ago
Update. The macro call is not the problem. Just including the header is sufficient:
#include <sys/wait.h>
Narrowed down to the lines of code that cause an assertion. Here is the simple case that does not include wait, ..
typedef union
{
union wait1 *__uptr;
} __WAIT_STATUS1;
union wait1
{
int w_status;
#ifdef GOOD
int __w_termsig;
#else
struct
{
int __w_termsig;
} __wait_terminated;
#endif
};
int main (void) {}
Additional notes:
Struct inside the union wait1 causes the assertion
If you reverse the order of typedef and union declarations code compiles, no assertion (I did not verify that the code is correct.
It appears this error (or perhaps similar on some other __extension__
in system headers) is now impacting a user of HipMer (an application of signifant current interest within the DOE):
https://groups.google.com/a/lbl.gov/d/msg/upc-users/Jmu9BtvaStw/P7BjVhhaAQAJ
AMDG
The root of the problem is that union wait1 is
being processed twice. It's supposed to be handled
when we reach the definition, but it gets processed
earlier at union wait1 *__uptr
In Christ, Steven Watanabe
AMDG
I think this can be fixed by changing TransformTranslationUnitDecl to use TransformDecl instead of TransformDeclaration (avoiding duplicate processing) and changing TransformDecl to look up the correct DeclContext instead of assuming that they are always processed depth-first.
In Christ, Steven Watanabe
I am running clang-upc2c 3.9.1-1 20171002 on a Scientific Linux 7.5 system (RHEL clone, like Centos). This system uses glbc 2.17.
The following 2-line program crashes clang-upc2c:
as show here:
Since this was a debug build of clang-upc2c, here is the backtrace from the generated core:
I wanted to provide a version of the reproducer with which one does not need to reproduce sys/wait.h from glibc 2.17. However, doing so seems to change the failure mode entirely: