[LLVMbugs] [Bug 16931] New: Clang fails to parse function calls when one argument is a structure containing an _Atomic type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 19 02:09:29 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16931

            Bug ID: 16931
           Summary: Clang fails to parse function calls when one argument
                    is a structure containing an _Atomic type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: csdavec at swan.ac.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Simple test case:


typedef struct { _Atomic(_Bool) flag; } flag;
_Bool f(flag*);

int
main(int argc, char *argv[])
{
   flag flag = { 0 };
   f(&flag);
   return 0;
}


The call to f does not appear in the AST:

$ ~/llvm/Debug/bin/clang test.c -fsyntax-only -Xclang -ast-dump
TranslationUnitDecl 0x806cb02d0 <<invalid sloc>>
|-TypedefDecl 0x806cb0810 <<invalid sloc>> __int128_t '__int128'
|-TypedefDecl 0x806cb0870 <<invalid sloc>> __uint128_t 'unsigned __int128'
|-TypedefDecl 0x806cb0bc0 <<invalid sloc>> __builtin_va_list '__va_list_tag
[1]'
|-RecordDecl 0x806cb0c10 <ed.c:1:9, col:39> struct
| `-FieldDecl 0x806cb0d00 <col:18, col:33> flag '_Atomic(_Bool)'
|-TypedefDecl 0x806cb0da0 <col:1, col:41> flag 'struct flag':'flag'
|-FunctionDecl 0x806cf5010 <line:2:1, col:14> f '_Bool (flag *)'
| `-ParmVarDecl 0x806cb0ea0 <col:9, col:14> 'flag *'
`-FunctionDecl 0x806cf5320 <line:4:1, line:10:1> main 'int (int, char **)'
  |-ParmVarDecl 0x806cf50d0 <line:5:6, col:10> argc 'int'
  |-ParmVarDecl 0x806cf5210 <col:16, col:27> argv 'char **':'char **'
  `-CompoundStmt 0x806cf5598 <line:6:1, line:10:1>
    |-DeclStmt 0x806cf5518 <line:7:4, col:21>
    | `-VarDecl 0x806cf53e0 <col:4, col:9> flag 'flag':'flag'
    `-ReturnStmt 0x806cf5578 <line:9:4, col:11>
      `-IntegerLiteral 0x806cf5558 <col:11> 'int' 0

This currently breaks stdatomic.h on FreeBSD.  No errors are emitted, and no
asserts are hit...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130819/7b218b62/attachment.html>


More information about the llvm-bugs mailing list