[Bug analyzer/101082] new test case gcc.dg/analyzer/bitfields-1.c from r12-1303 fails on BE

2021-07-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101082

--- Comment #5 from CVS Commits  ---
The releases/gcc-11 branch has been updated by David Malcolm
:

https://gcc.gnu.org/g:21b470a9c976f3db7cce6d58a07c58a58676f93c

commit r11-8681-g21b470a9c976f3db7cce6d58a07c58a58676f93c
Author: David Malcolm 
Date:   Fri Jul 2 15:19:46 2021 -0400

analyzer: fix bitfield endianness issues [PR99212,PR101082]

Looks like my patch for PR analyzer/99212 implicitly assumed
little-endian, which the following patch fixes.

Fixes bitfields-1.c on:
- armeb-none-linux-gnueabihf
- cris-elf
- powerpc64-darwin
- s390-linux-gnu

gcc/analyzer/ChangeLog:
PR analyzer/99212
PR analyzer/101082
* engine.cc: Include "target.h".
(impl_run_checkers): Log BITS_BIG_ENDIAN, BYTES_BIG_ENDIAN, and
WORDS_BIG_ENDIAN.
* region-model-manager.cc
(region_model_manager::maybe_fold_binop): Move support for masking
via ARG0 & CST into...
(region_model_manager::maybe_undo_optimize_bit_field_compare):
...this new function.  Flatten by converting from nested
conditionals to a series of early return statements to reject
failures.  Reject if type is not unsigned_char_type_node.
Handle BYTES_BIG_ENDIAN when determining which bits are bound
in the binding_map.
* region-model.h
(region_model_manager::maybe_undo_optimize_bit_field_compare):
New decl.
* store.cc (bit_range::dump): New function.
* store.h (bit_range::dump): New decl.

Signed-off-by: David Malcolm 

[Bug analyzer/101082] new test case gcc.dg/analyzer/bitfields-1.c from r12-1303 fails on BE

2021-06-15 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101082

David Malcolm  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from David Malcolm  ---
Should be fixed by the above commit.  Please reopen if it's still failing on
another target.  Sorry again for the breakage.

[Bug analyzer/101082] new test case gcc.dg/analyzer/bitfields-1.c from r12-1303 fails on BE

2021-06-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101082

--- Comment #3 from CVS Commits  ---
The master branch has been updated by David Malcolm :

https://gcc.gnu.org/g:ec3fafa9ec7d16b9d89076efd3bac1d1af0502b8

commit r12-1491-gec3fafa9ec7d16b9d89076efd3bac1d1af0502b8
Author: David Malcolm 
Date:   Tue Jun 15 17:53:34 2021 -0400

analyzer: fix bitfield endianness issues [PR99212,PR101082]

Looks like my patch for PR analyzer/99212 implicitly assumed
little-endian, which the following patch fixes.

Fixes bitfields-1.c on:
- armeb-none-linux-gnueabihf
- cris-elf
- powerpc64-darwin
- s390-linux-gnu

gcc/analyzer/ChangeLog:
PR analyzer/99212
PR analyzer/101082
* engine.cc: Include "target.h".
(impl_run_checkers): Log BITS_BIG_ENDIAN, BYTES_BIG_ENDIAN, and
WORDS_BIG_ENDIAN.
* region-model-manager.cc
(region_model_manager::maybe_fold_binop): Move support for masking
via ARG0 & CST into...
(region_model_manager::maybe_undo_optimize_bit_field_compare):
...this new function.  Flatten by converting from nested
conditionals to a series of early return statements to reject
failures.  Reject if type is not unsigned_char_type_node.
Handle BYTES_BIG_ENDIAN when determining which bits are bound
in the binding_map.
* region-model.h
(region_model_manager::maybe_undo_optimize_bit_field_compare):
New decl.
* store.cc (bit_range::dump): New function.
* store.h (bit_range::dump): New decl.

Signed-off-by: David Malcolm 

[Bug analyzer/101082] new test case gcc.dg/analyzer/bitfields-1.c from r12-1303 fails on BE

2021-06-15 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101082

--- Comment #2 from seurer at gcc dot gnu.org ---
Ah, crud.  I picked the wrong test case to look at.  If I'd searched on
gcc.dg/analyzer/data-model-1.c I would have seen that other PR.

[Bug analyzer/101082] new test case gcc.dg/analyzer/bitfields-1.c from r12-1303 fails on BE

2021-06-15 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101082

David Malcolm  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-06-15
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from David Malcolm  ---
Sorry about this.  As noted in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99212#c18 I'm testing a fix for
targets where BYTES_BIG_ENDIAN is set; FWIW the fix seems to work on
--target=powerpc64-darwin.