[Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type

2023-04-22 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25186 Roger Sayle changed: What|Removed |Added Target Milestone|--- |13.0 Status|NEW

[Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type

2021-09-02 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25186 Richard Biener changed: What|Removed |Added Keywords||easyhack Last reconfirmed|2021-08-21

[Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type

2021-09-01 Thread gabravier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25186 Gabriel Ravier changed: What|Removed |Added CC||gabravier at gmail dot com --- Comment

[Bug middle-end/25186] (short)(((int)short_var) 1) should be folded so that the shift is done in the short type

2006-04-05 Thread rguenth at gcc dot gnu dot org
--- Comment #7 from rguenth at gcc dot gnu dot org 2006-04-05 13:49 --- I'm no longer working on this. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added

[Bug middle-end/25186] (short)(((int)short_var) 1) should be folded so that the shift is done in the short type

2005-12-01 Thread rguenth at gcc dot gnu dot org
--- Comment #2 from rguenth at gcc dot gnu dot org 2005-12-01 10:53 --- Confirmed. The first testcase is really just short *a; void f(void) { *a = *a 1; } interestingly, the C frontend does not do integer promotion of unsigned short *a; void f(voif) { *a = *a 1; } where *a

[Bug middle-end/25186] (short)(((int)short_var) 1) should be folded so that the shift is done in the short type

2005-12-01 Thread rguenth at gcc dot gnu dot org
--- Comment #3 from rguenth at gcc dot gnu dot org 2005-12-01 11:01 --- Doh. The C frontend _does_ the promotion (in the unsigned case): (intD.0) *aD.1296 1 just convert.c:convert_to_integer folds it to a shift on unsigned short again. This transformation should be moved to fold

[Bug middle-end/25186] (short)(((int)short_var) 1) should be folded so that the shift is done in the short type

2005-12-01 Thread rguenth at gcc dot gnu dot org
--- Comment #4 from rguenth at gcc dot gnu dot org 2005-12-01 12:28 --- convert_to_integer contains case LSHIFT_EXPR: /* We can pass truncation down through left shifting when the shift count is a nonnegative constant and the target type is

[Bug middle-end/25186] (short)(((int)short_var) 1) should be folded so that the shift is done in the short type

2005-12-01 Thread rguenth at gcc dot gnu dot org
--- Comment #5 from rguenth at gcc dot gnu dot org 2005-12-01 12:46 --- I.e. 6.3.1.3/3 says that conversion from type T to signed type is implementation defined if the value doesn't fit. And we define it to reducing it modulo 2^N. So, for !flag_wrapv (short)((int)0x8000 1) == 0

[Bug middle-end/25186] (short)(((int)short_var) 1) should be folded so that the shift is done in the short type

2005-12-01 Thread rguenth at gcc dot gnu dot org
--- Comment #6 from rguenth at gcc dot gnu dot org 2005-12-01 14:17 --- I have two fixes. One really safe and one ok via IRC communication. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added