RFH: compile-time assertions now broken in GCC
Hi,
https://bugs.launchpad.net/ubuntu/+source/mksh/+bug/1058035 was just the beginning, as gcc-snapshot in Debian had it (I wrote that in the bugreport already), but, now, gcc-4.{6,7} in sid also have it. I’ve just tracked it down for gcc-4.6 to have been introdu‐ ced between 4.6.3-9 and 4.6.3-10; gcc-4.7 as currently sits in wheezy (4.7.1-7) doesn’t have the problem, 4.7.2-2 does. tg@zigo:~/b $ cat t.c #include <stdint.h> typedef int32_t mksh_ari_t; char ari_sign_32_bit_and_wrap[( (mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 1) > (mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 2) ) ? 1 : -1]; int main(void) { return (sizeof(ari_sign_32_bit_and_wrap)); } tg@zigo:~/b $ gcc-4.6 -O -Wextra t.c t.c:6:62: warning: integer overflow in expression [-Woverflow] t.c:3:6: error: variably modified ‘ari_sign_32_bit_and_wrap’ at file scope My question now is, how am I supposed to deal with that? Will the affected gcc versions transition into wheezy? In that case I’ll need to apply the hotfix I made for Ubuntu into Debian as well, so I’d like an answer. More generally, why does GCC suddenly break such compile-time check constructs? (mksh guarantees to scripts it runs that all arithmetic operations are 32-bit and that both signed and un‐ signed operations wrap around, so it *must* know whether the system does that correctly. And its build script is cross-com‐ pile agnostic, so it doesn’t do run-time checks.) Thanks in advance, //mirabilos -- “It is inappropriate to require that a time represented as seconds since the Epoch precisely represent the number of seconds between the referenced time and the Epoch.” -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2 -- To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: Pine.BSM.4.64L.1210031354150.16041@herc.mirbsd.org ">http://lists.debian.org/Pine.BSM.4.64L.1210031354150.16041@herc.mirbsd.org |
RFH: compile-time assertions now broken in GCC
On 03.10.2012 15:59, Thorsten Glaser wrote:
> Hi, > > https://bugs.launchpad.net/ubuntu/+source/mksh/+bug/1058035 > was just the beginning, as gcc-snapshot in Debian had it (I > wrote that in the bugreport already), but, now, gcc-4.{6,7} > in sid also have it. > > I’ve just tracked it down for gcc-4.6 to have been introdu‐ > ced between 4.6.3-9 and 4.6.3-10; gcc-4.7 as currently sits > in wheezy (4.7.1-7) doesn’t have the problem, 4.7.2-2 does. > > tg@zigo:~/b $ cat t.c > #include <stdint.h> > typedef int32_t mksh_ari_t; > char ari_sign_32_bit_and_wrap[( > > (mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 1) > > (mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 2) > > ) ? 1 : -1]; > > int main(void) { return (sizeof(ari_sign_32_bit_and_wrap)); } > tg@zigo:~/b $ gcc-4.6 -O -Wextra t.c > t.c:6:62: warning: integer overflow in expression [-Woverflow] > t.c:3:6: error: variably modified ‘ari_sign_32_bit_and_wrap’ at file scope > > My question now is, how am I supposed to deal with that? Will > the affected gcc versions transition into wheezy? In that case > I’ll need to apply the hotfix I made for Ubuntu into Debian as > well, so I’d like an answer. > > More generally, why does GCC suddenly break such compile-time > check constructs? (mksh guarantees to scripts it runs that all > arithmetic operations are 32-bit and that both signed and un‐ > signed operations wrap around, so it *must* know whether the > system does that correctly. And its build script is cross-com‐ > pile agnostic, so it doesn’t do run-time checks.) how does gcc-snapshot behave? If you think it's a regression, please could you forward it upstream? thanks, Matthias -- To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 506D9C1A.9070900@debian.org">http://lists.debian.org/506D9C1A.9070900@debian.org |
RFH: compile-time assertions now broken in GCC
Matthias Klose dixit:
>how does gcc-snapshot behave? It also introduces this failure. >If you think it's a regression, please could you forward it upstream? OK. In the meantime, I’ve prepared workarounds upstream (and made the code a bit less depending on -fwrapv), but I need to know whether I should upload mksh to sid now with the hotfix applied to Ubuntu, i.e. whether you plan to have the affected gcc versions migrate. bye, //mirabilos -- Sometimes they [people] care too much: pretty printers [and syntax highligh- ting, d.A.] mechanically produce pretty output that accentuates irrelevant detail in the program, which is as sensible as putting all the prepositions in English text in bold font. -- Rob Pike in "Notes on Programming in C" -- To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: Pine.BSM.4.64L.1210041655180.13141@herc.mirbsd.org ">http://lists.debian.org/Pine.BSM.4.64L.1210041655180.13141@herc.mirbsd.org |
RFH: compile-time assertions now broken in GCC
On 04.10.2012 18:57, Thorsten Glaser wrote:
> Matthias Klose dixit: > >> how does gcc-snapshot behave? > > It also introduces this failure. > >> If you think it's a regression, please could you forward it upstream? > > OK. In the meantime, I’ve prepared workarounds upstream (and > made the code a bit less depending on -fwrapv), but I need to > know whether I should upload mksh to sid now with the hotfix > applied to Ubuntu, i.e. whether you plan to have the affected > gcc versions migrate. I'll propose 4.7.2-4 for testing, so please update. However I couldn't find the upstream GCC issue. Matthias -- To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 507608CB.7030705@debian.org">http://lists.debian.org/507608CB.7030705@debian.org |
RFH: compile-time assertions now broken in GCC
Matthias Klose dixit:
>I'll propose 4.7.2-4 for testing, so please update. OK thanks for the heads-up, will do after I get over the worst of this cold I caught. >However I couldn't find the upstream GCC issue. Didn’t report one yet, had too much dayjob-related stuff to do this week. Will do. bye, //mirabilos -- <Natureshadow> Oh, ich hab mim Bauch Mittelklick gemacht, als ich nach dem Kaffee gegriffen habe… <mirabilos> Cool, ich hab ne neue eMail-Signatur <Natureshadow> Sag doch sowas nich, wenn ich den Kaffee in der Hand habe! Gib mir nen Lappen! Schnell! Das kommt aber nicht mit in die Signatur! -- To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: Pine.BSM.4.64L.1210121402400.17617@herc.mirbsd.org ">http://lists.debian.org/Pine.BSM.4.64L.1210121402400.17617@herc.mirbsd.org |
| All times are GMT. The time now is 12:55 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.