Bug#652356: please use argument-safe bswap macros on all architectures
Dixi quod… Jonathan Nieder dixit: Thorsten, can you test this patch or arrange for it to be tested? Will do that Built, WFM. bye, //mirabilos -- “Having a smoking section in a restaurant is like having a peeing section in a swimming pool.” -- Edward Burr -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pine.bsm.4.64l.1112192220430@herc.mirbsd.org
Re: Bug#652356: please use argument-safe bswap macros on all architectures
On Sat, Dec 17, 2011 at 02:52:53AM +, Thorsten Glaser wrote: Aurelien Jarno dixit: I have dropped it in favor of the default version for the next upload. Why don’t you just use these? (Tested for 32-bit and 64-bit both.) I am not an m68k porter, and I am not planning to try things. m68k is lagging upstream wrt other architectures. Please work with upstream to fix things, then I can include tested and accepted patches. I’ve not looked at other architectures atm though. Other architectures don't have this problem with byteswap.h -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20111217112848.gg9...@hall.aurel32.net
Bug#652356: please use argument-safe bswap macros on all architectures
Aurelien Jarno dixit: I am not an m68k porter, and I am not planning to try things. m68k is lagging upstream wrt other architectures. Please work with upstream to fix things, then I can include tested and accepted patches. I’m not an m68k porter either, but this fix is easily done from working with a libc (BSD libc in my case) skills. But okay. Am I guessing that libc-po...@sourceware.org is “upstream”? It was hard to find information about eglibc-ports on the ’net. Anyway, here it is: Dixi quod… Aurelien Jarno dixit: I have dropped it in favor of the default version for the next upload. Why don’t you just use these? (Tested for 32-bit and 64-bit both.) I’ve not looked at other architectures atm though. --- usr/include/m68k-linux-gnu/bits/byteswap.h~2011-12-17 02:44:08.0 + +++ usr/include/m68k-linux-gnu/bits/byteswap.h 2011-12-17 02:49:34.0 + @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. m68k version. - Copyright (C) 1997, 2002, 2008 Free Software Foundation, Inc. + Copyright (C) 1997, 2002, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,15 +50,15 @@ #if defined __GNUC__ __GNUC__ = 2 !defined(__mcoldfire__) # define __bswap_32(x) \ __extension__ \ - ({ unsigned int __bswap_32_v; \ - if (__builtin_constant_p (x))\ - __bswap_32_v = __bswap_constant_32 (x);\ + ({ unsigned int __bswap_32_v, __bswap_32_x = (x); \ + if (__builtin_constant_p (__bswap_32_x)) \ + __bswap_32_v = __bswap_constant_32 (__bswap_32_x); \ else \ __asm__ __volatile__ (ror%.w %#8, %0;\ swap %0; \ ror%.w %#8, %0 \ : =d (__bswap_32_v) \ - : 0 ((unsigned int) (x))); \ + : 0 (__bswap_32_x)); \ __bswap_32_v; }) #else static __inline unsigned int @@ -85,11 +85,12 @@ __extension__ \ ({ union { unsigned long long int __ll; \ unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r;\ - if (__builtin_constant_p (x))\ - __bswap_64_r.__ll = __bswap_constant_64 (x); \ + unsigned long long int __bswap_64_x = (x); \ + if (__builtin_constant_p (__bswap_64_x)) \ + __bswap_64_r.__ll = __bswap_constant_64 (__bswap_64_x); \ else \ { \ - __bswap_64_v.__ll = (x); \ + __bswap_64_v.__ll = __bswap_64_x; \ __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]);\ __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]);\ } \ Aurelien Jarno dixit: Other architectures don't have this problem with byteswap.h I see. I didn’t know that for sure, so I suggested that in general someone should look at it. bye, //mirabilos PS: Please fix your MTA; hall.aurel32.net is sending 8-bit data to a receiving MTA that does not announce 8BITMIME support in its EHLO response. Or your MUA to use Quoted- Printable by default. -- “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-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pine.bsm.4.64l.1112171247170@herc.mirbsd.org
Re: Bug#652356: please use argument-safe bswap macros on all architectures
On Sat, Dec 17, 2011 at 12:51:48PM +, Thorsten Glaser wrote: Aurelien Jarno dixit: I am not an m68k porter, and I am not planning to try things. m68k is lagging upstream wrt other architectures. Please work with upstream to fix things, then I can include tested and accepted patches. I’m not an m68k porter either, but this fix is easily done from working If you are not an m68k porter, you should simply stop to care about m68k porting issues. The glibc maintainers can add patches or pull patches from upstream to fix some issues, but they are not there to replace missing porters or upstream writing or testing patches. And we are not going to add random patches not even test built on m68k to fix this kind of issue, as anyway you would be the first to complain if it does not build or has side effects. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20111217143154.ga...@volta.aurel32.net
Bug#652356: please use argument-safe bswap macros on all architectures
Aurelien Jarno dixit: If you are not an m68k porter, you should simply stop to care about m68k porting issues. I care about the entire Open Source ecosystem. (Way to motivate people.) bye, //mirabilos -- 13:22⎜«neurodamage» mira, what's up man? I have a CVS question for you in #cvs 13:22⎜«neurodamage» since you're so good w. it │ «neurodamage:#cvs» i love you 13:28⎜«neurodamage:#cvs» you're a handy guy to have around for systems stuff ☺ 16:06⎜Draget:#cvs Thank god I found you =) 20:03│«bioe007:#cvs» mira2k: ty 17:14⎜ldiain:#cvs Thanks big help you are :-) bioe007 mira|nwt: ty again 18:35⎜«alturiak:#cvs» mirabilos: aw, nice. thanks :o 18:36⎜«ThunderChicken:#cvs» mirabilos FTW! 23:03⎜«mithraic:#cvs» aaah. thanks 18:41⎜«alturiak:#cvs» phew. thanks a bunch, guys. you just made my weekend :-) 18:10⎜«sumit:#cvs» mirabilos: oh ok.. thanks for that 21:57⎜bhuey:#cvs yeah, I really appreciate help 18:50⎜«grndlvl:#cvs» thankyou18:50⎜«grndlvl:#cvs» worked perfectly 20:50⎜paolo:#cvs i see. mirabilos, thnks for your support 00:36⎜«halirutan:#cvs» ok, the obvious way:-) thx 18:44⎜«arcfide:#cvs» mirabilos, I am running OpenBSD. 18:59⎜«arcfide:#cvs» Hrm, yes, I see what you mean. 19:01⎜«arcfide:#cvs» Yeah, thanks for the help. 21:33⎜«CardinalFang:#cvs» Ugh. Okay. Sorry for the dumb question. Thank you 21:34⎜centosian:#cvs mirabilos: whoa that's sweet 21:52⎜«garrett__:#cvs» much appreciated «garrett__:#cvs» thanks for your time 23:39⎜symons:#cvs this worked, thank you very much 16:26⎜schweizer:#cvs ok thx, i'll try that 20:00⎜«stableable:#cvs» Thank you.20:50⎜«s833:#cvs» mirabilos: thanks a lot.19:34⎜bobbytek:#cvs Thanks for confirming :) 20:08⎜tsolox:#cvs ...works like a charm.. thanks mirabilos -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pine.bsm.4.64l.1112171443480@herc.mirbsd.org
Bug#652356: please use argument-safe bswap macros on all architectures
Source: eglibc Hi, (from #595496) please make sure that this passes on all architectures: cat x.c 'EOF' #include stddef.h #include stdint.h #include byteswap.h uint32_t foo(uint32_t *bar, size_t *baz) { return (bswap_32(bar[(*baz)++])); } EOF gcc -Wall -c x.c On amd64 it passes, on m68k it gives: x.c: In function ‘foo’: x.c:6:10: warning: operation on ‘*baz’ may be undefined [-Wsequence-point] x.c:6:10: warning: operation on ‘*baz’ may be undefined [-Wsequence-point] x.c:6:10: warning: operation on ‘*baz’ may be undefined [-Wsequence-point] The difference is in /usr/include/$multiarsch/bits/byteswap.h: # define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __v, __x = (x);\ if (__builtin_constant_p (__x)) \ […] (amd64) vs. (m68k) # define __bswap_32(x) \ __extension__ \ ({ unsigned int __bswap_32_v; \ if (__builtin_constant_p (x)) \ […] That is, the amd64 version evaluates the argument only once. Please ensure all flavours of the bswap macros on all architectures behave the same; otherwise it’s an introduction to porting issues that need not be. Porting is joyful enough already ;-) Thanks in advance, //mirabilos -- [...] if maybe ext3fs wasn't a better pick, or jfs, or maybe reiserfs, oh but what about xfs, and if only i had waited until reiser4 was ready... in the be- ginning, there was ffs, and in the middle, there was ffs, and at the end, there was still ffs, and the sys admins knew it was good. :) -- Ted Unangst über *fs -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pine.bsm.4.64l.1112161525050@herc.mirbsd.org
Bug#652356: please use argument-safe bswap macros on all architectures
On Fri, Dec 16, 2011 at 03:29:59PM +, Thorsten Glaser wrote: Source: eglibc Hi, (from #595496) please make sure that this passes on all architectures: cat x.c 'EOF' #include stddef.h #include stdint.h #include byteswap.h uint32_t foo(uint32_t *bar, size_t *baz) { return (bswap_32(bar[(*baz)++])); } EOF gcc -Wall -c x.c On amd64 it passes, on m68k it gives: x.c: In function ‘foo’: x.c:6:10: warning: operation on ‘*baz’ may be undefined [-Wsequence-point] x.c:6:10: warning: operation on ‘*baz’ may be undefined [-Wsequence-point] x.c:6:10: warning: operation on ‘*baz’ may be undefined [-Wsequence-point] The difference is in /usr/include/$multiarsch/bits/byteswap.h: # define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __v, __x = (x); \ if (__builtin_constant_p (__x)) \ […] (amd64) vs. (m68k) # define __bswap_32(x) \ __extension__ \ ({ unsigned int __bswap_32_v; \ if (__builtin_constant_p (x)) \ […] That is, the amd64 version evaluates the argument only once. Please ensure all flavours of the bswap macros on all architectures behave the same; otherwise it’s an introduction to porting issues that need not be. Porting is joyful enough already ;-) The file is different on architectures providing an optimized version of bswap functions. The m68k optimized version is lagging behind the others architectures and as you show, it is therefore broken. I have dropped it in favor of the default version for the next upload. This way it will behave like other architectures. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20111217005242.ge9...@hall.aurel32.net
Bug#652356: please use argument-safe bswap macros on all architectures
Aurelien Jarno dixit: I have dropped it in favor of the default version for the next upload. Why don’t you just use these? (Tested for 32-bit and 64-bit both.) I’ve not looked at other architectures atm though. --- usr/include/m68k-linux-gnu/bits/byteswap.h~ 2011-12-17 02:44:08.0 + +++ usr/include/m68k-linux-gnu/bits/byteswap.h 2011-12-17 02:49:34.0 + @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. m68k version. - Copyright (C) 1997, 2002, 2008 Free Software Foundation, Inc. + Copyright (C) 1997, 2002, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,15 +50,15 @@ #if defined __GNUC__ __GNUC__ = 2 !defined(__mcoldfire__) # define __bswap_32(x) \ __extension__\ - ({ unsigned int __bswap_32_v;\ - if (__builtin_constant_p (x)) \ - __bswap_32_v = __bswap_constant_32 (x); \ + ({ unsigned int __bswap_32_v, __bswap_32_x = (x);\ + if (__builtin_constant_p (__bswap_32_x)) \ + __bswap_32_v = __bswap_constant_32 (__bswap_32_x); \ else \ __asm__ __volatile__ (ror%.w %#8, %0; \ swap %0; \ ror%.w %#8, %0 \ : =d (__bswap_32_v) \ -: 0 ((unsigned int) (x))); \ +: 0 (__bswap_32_x)); \ __bswap_32_v; }) #else static __inline unsigned int @@ -85,11 +85,12 @@ __extension__ \ ({ union { unsigned long long int __ll; \ unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r;\ - if (__builtin_constant_p (x)) \ - __bswap_64_r.__ll = __bswap_constant_64 (x);\ + unsigned long long int __bswap_64_x = (x); \ + if (__builtin_constant_p (__bswap_64_x)) \ + __bswap_64_r.__ll = __bswap_constant_64 (__bswap_64_x); \ else \ { \ -__bswap_64_v.__ll = (x); \ +__bswap_64_v.__ll = __bswap_64_x; \ __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]);\ __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]);\ } \ bye, //mirabilos -- “Having a smoking section in a restaurant is like having a peeing section in a swimming pool.” -- Edward Burr -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pine.bsm.4.64l.1112170250430@herc.mirbsd.org