Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Comparison between altivec vector bool types are not allowed by clang #32324

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR33352
Status NEW
Importance P enhancement
Reported by Zixuan Wu (westion717@gmail.com)
Reported on 2017-06-07 22:25:45 -0700
Last modified on 2017-06-11 21:27:20 -0700
Version trunk
Hardware Other Linux
CC llvm-bugs@lists.llvm.org, westion717@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
It seems that AST parsing is not correct.

int main(){
  vector  long long op_median = { 1, 4 };
  vector  long long op_less = { 0, 3 };
  if ( ++op_less == op_median ) return 1;
  return 0;
}

clang -maltivec -Xclang  -ast-dump -fsyntax-only   b.c

\TranslationUnitDecl 0x100173218b0 <<invalid sloc>> <invalid sloc>
|-TypedefDecl 0x10017321e00 <<invalid sloc>> <invalid sloc> implicit __int128_t
'__int128'
| `-BuiltinType 0x10017321b20 '__int128'
|-TypedefDecl 0x10017321e70 <<invalid sloc>> <invalid sloc> implicit
__uint128_t 'unsigned __int128'
| `-BuiltinType 0x10017321b40 'unsigned __int128'
|-TypedefDecl 0x10017322148 <<invalid sloc>> <invalid sloc> implicit
__NSConstantString 'struct __NSConstantString_tag'
| `-RecordType 0x10017321f50 'struct __NSConstantString_tag'
|   `-Record 0x10017321ec8 '__NSConstantString_tag'
|-TypedefDecl 0x100173221e0 <<invalid sloc>> <invalid sloc> implicit
__builtin_va_list 'char *'
| `-PointerType 0x100173221a0 'char *'
|   `-BuiltinType 0x10017321940 'char'
`-FunctionDecl 0x10017322290 <b.c:1:1, line:6:1> line:1:5 main 'int ()'
  `-CompoundStmt 0x10017361a90 <col:11, line:6:1>
    |-DeclStmt 0x10017322518 <line:2:3, col:40>
    | `-VarDecl 0x100173223a8 <col:3, col:39> col:20 used op_median '__vector long long' cinit
    |   `-InitListExpr 0x10017322498 <col:32, col:39> '__vector long long'
    |     |-ImplicitCastExpr 0x100173224e8 <col:34> 'long long' <IntegralCast>
    |     | `-IntegerLiteral 0x10017322408 <col:34> 'int' 1
    |     `-ImplicitCastExpr 0x10017322500 <col:37> 'long long' <IntegralCast>
    |       `-IntegerLiteral 0x10017322428 <col:37> 'int' 4
    |-DeclStmt 0x10017361920 <line:3:3, col:38>
    | `-VarDecl 0x10017322540 <col:3, col:37> col:20 used op_less '__vector long long' cinit
    |   `-InitListExpr 0x100173618a0 <col:30, col:37> '__vector long long'
    |     |-ImplicitCastExpr 0x100173618f0 <col:32> 'long long' <IntegralCast>
    |     | `-IntegerLiteral 0x100173225a0 <col:32> 'int' 0
    |     `-ImplicitCastExpr 0x10017361908 <col:35> 'long long' <IntegralCast>
    |       `-IntegerLiteral 0x100173225c0 <col:35> 'int' 3
   |-IfStmt 0x10017361a20 <line:4:3, col:40>
    | |-<<<NULL>>>
    | |-<<<NULL>>>
    | |-BinaryOperator 0x100173619c0 <col:8, col:21> 'int' '=='
    | | |-UnaryOperator 0x10017361960 <col:8, col:10> '__vector long long' prefix '++'
    | | | `-DeclRefExpr 0x10017361938 <col:10> '__vector long long' lvalue Var 0x10017322540 'op_less' '__vector long long'
    | | `-ImplicitCastExpr 0x100173619a8 <col:21> '__vector long long' <LValueToRValue>
    | |   `-DeclRefExpr 0x10017361980 <col:21> '__vector long long' lvalue Var 0x100173223a8 'op_median' '__vector long long'
    | |-ReturnStmt 0x10017361a08 <col:33, col:40>
    | | `-IntegerLiteral 0x100173619e8 <col:40> 'int' 1
    | `-<<<NULL>>>
    `-ReturnStmt 0x10017361a78 <line:5:3, col:10>
      `-IntegerLiteral 0x10017361a58 <col:10> 'int' 0

int main(){
  vector bool long long op_median = { 1, 4 };
  vector bool long long op_less = { 0, 3 };
  if ( ++op_less == op_median ) return 1;
  return 0;
}

FunctionDecl 0x10015bb2290 <a.c:1:1, line:6:1> line:1:5 main 'int ()'
  `-CompoundStmt 0x10015bf1f08 <col:11, line:6:1>
    |-DeclStmt 0x10015bb2518 <line:2:3, col:45>
    | `-VarDecl 0x10015bb23a8 <col:3, col:44> col:25 used op_median '__vector __bool unsigned long long' cinit
    |   `-InitListExpr 0x10015bb2498 <col:37, col:44> '__vector __bool unsigned long long'
    |     |-ImplicitCastExpr 0x10015bb24e8 <col:39> 'unsigned long long' <IntegralCast>
    |     | `-IntegerLiteral 0x10015bb2408 <col:39> 'int' 1
    |     `-ImplicitCastExpr 0x10015bb2500 <col:42> 'unsigned long long' <IntegralCast>
    |       `-IntegerLiteral 0x10015bb2428 <col:42> 'int' 4
    |-DeclStmt 0x10015bf1930 <line:3:3, col:43>
    | `-VarDecl 0x10015bb2540 <col:3, col:42> col:25 used op_less '__vector __bool unsigned long long' cinit
    |   `-InitListExpr 0x10015bf18b0 <col:35, col:42> '__vector __bool unsigned long long'
    |     |-ImplicitCastExpr 0x10015bf1900 <col:37> 'unsigned long long' <IntegralCast>
    |     | `-IntegerLiteral 0x10015bb25a0 <col:37> 'int' 0
    |     `-ImplicitCastExpr 0x10015bf1918 <col:40> 'unsigned long long' <IntegralCast>
    |       `-IntegerLiteral 0x10015bb25c0 <col:40> 'int' 3
    |-IfStmt 0x10015bf1e98 <line:4:3, col:40>
    | |-<<<NULL>>>
    | |-<<<NULL>>>
    | |-OpaqueValueExpr 0x10015bf1e78 <<invalid sloc>> '_Bool'
    | |-ReturnStmt 0x10015bf1e60 <col:33, col:40>
    | | `-IntegerLiteral 0x10015bf1e40 <col:40> 'int' 1
    | `-<<<NULL>>>
    `-ReturnStmt 0x10015bf1ef0 <line:5:3, col:10>
      `-IntegerLiteral 0x10015bf1ed0 <col:10> 'int' 0
Quuxplusone commented 7 years ago
The step to reproduce error.

int main(){
  vector bool long long op_median = { 1, 4 };
  vector bool long long op_less = { 0, 3 };
  if ( ++op_less == op_median ) return 1;
  return 0;
}

clang -maltivec    a.c
a.c:4:3: error: statement requires expression of scalar type
('__attribute__((__vector_size__(2 * sizeof(long long)))) long long' (vector of
2 'long long' values) invalid)
  if ( ++op_less == op_median ) return 1;
  ^    ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.