Henric added a comment.

Hi
With this patch, the following code gives me a warning that I don't think is 
intentional.

  typedef struct S {
    int x:4;
  } S;
  
  void foo(S s) {
    for (int i=10; i > s.x; --i) ;
  }
  
  loop_var.c:6:22: warning: loop variable has narrower type 'int:4' than 
iteration's upper bound 'int' [bugprone-too-small-loop-variable]
  for (int i=10; i > s.x; --i) ;
                     ^

Looks like the logic i reversed here, so the loop variable gets the bit field 
type.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142587/new/

https://reviews.llvm.org/D142587

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D142587: [clang-ti... Henric Karlsson via Phabricator via cfe-commits

Reply via email to