Re: undefined behaviour findings in bitset

2019-03-23 Thread Bruno Haible
Hi Akim, > it does not work with G++ in C++98 mode: _Noreturn is not supported there. I confirm: No g++ version I tested supported _Noreturn, neither with -std=c++98 nor with -std=c++11. Your patch looks good. > Using C's _Noreturn in C++98 appears to be supported by Clang Good point! Let me a

Re: undefined behaviour findings in bitset

2019-03-22 Thread Akim Demaille
Hi Bruno, > Le 19 mars 2019 à 07:07, Akim Demaille a écrit : > > Hi Bruno, > >> Le 18 mars 2019 à 22:03, Bruno Haible a écrit : >> >> Hi Akim, >> >>> Also, the relationship with noreturn.h is not completely clear for >>> me either. >> >> There are a couple of comment in noreturn.h lines 33.

Re: undefined behaviour findings in bitset

2019-03-20 Thread Akim Demaille
Hi Bruno, > Le 20 mars 2019 à 04:39, Bruno Haible a écrit : > > Akim Demaille wrote: >> Also, the relationship with noreturn.h is not completely clear for >> me either. > > I'm adding this documentation: > > 2019-03-19 Bruno Haible > > doc: Document the 'stdnoreturn' and 'noreturn' m

Re: undefined behaviour findings in bitset

2019-03-19 Thread Bruno Haible
Akim Demaille wrote: > Also, the relationship with noreturn.h is not completely clear for > me either. I'm adding this documentation: 2019-03-19 Bruno Haible doc: Document the 'stdnoreturn' and 'noreturn' modules. Reported by Akim Demaille. * doc/noreturn.texi: New fi

Re: undefined behaviour findings in bitset

2019-03-18 Thread Akim Demaille
Hi Bruno, > Le 18 mars 2019 à 22:03, Bruno Haible a écrit : > > Hi Akim, > >> Also, the relationship with noreturn.h is not completely clear for >> me either. > > There are a couple of comment in noreturn.h lines 33..41. But I agree, > some text in the documentation would be better. > >> Clan

Re: undefined behaviour findings in bitset

2019-03-18 Thread Bruno Haible
Hi Akim, > Also, the relationship with noreturn.h is not completely clear for > me either. There are a couple of comment in noreturn.h lines 33..41. But I agree, some text in the documentation would be better. > Clang 7 pretends to be GCC 4.2 (__GNUC__ __GNUC_MINOR__). > For instance I see it a

Re: undefined behaviour findings in bitset

2019-03-18 Thread Akim Demaille
Le 17 mars 2019 à 20:27, Bruno Haible a écrit :Hi Akim,But GCC 4.7 does not support [[noreturn]] yet, even in gnu++11 mode.I need something like the following changes.-# if 201103 <= (defined __cplusplus ? __cplusplus : 0)+# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \+  && 4 < __GN

Re: undefined behaviour findings in bitset

2019-03-17 Thread Bruno Haible
Hi Akim, > But GCC 4.7 does not support [[noreturn]] yet, even in gnu++11 mode. > > I need something like the following changes. > -# if 201103 <= (defined __cplusplus ? __cplusplus : 0) > +# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \ > + && 4 < __GNUC__ + (8 <= __GNUC_MINOR__)

Re: undefined behaviour findings in bitset

2019-03-17 Thread Paul Eggert
Akim Demaille wrote: Wouldn't it be useful to have a file that defines macros such as GL_GCC_VERSION libc-config.h defines __GNUC_PREREQ, which is the most common spelling for such a macro. It's in the libc-config module. This was originally designed for code shared with glibc but can be used

Re: undefined behaviour findings in bitset

2019-03-17 Thread Akim Demaille
Le 17 mars 2019 à 08:39, Akim Demaille a écrit : > > commit 4d9813bf6bbf6489c1de4ad9d48943b961976bce > Author: Akim Demaille > Date: Sun Mar 17 08:34:22 2019 +0100 > >bitset, timevar: Depend on c99 > >Reported by Bruno Haible. >* modules/bitset, modules/timevar (Depends-on): Add

Re: undefined behaviour findings in bitset

2019-03-17 Thread Akim Demaille
> Le 16 mars 2019 à 20:53, Bruno Haible a écrit : > > Hi Akim, > > In the first patch: >> + for (bitset_windex windex = bitno / BITSET_WORD_BITS; >> + (windex - woffset) < EBITSET_ELT_WORDS; windex++) > > This is C99 syntax. If you don't add 'c99' as a dependency of yo

Re: undefined behaviour findings in bitset

2019-03-16 Thread Bruno Haible
Hi Akim, In the first patch: > + for (bitset_windex windex = bitno / BITSET_WORD_BITS; > + (windex - woffset) < EBITSET_ELT_WORDS; windex++) This is C99 syntax. If you don't add 'c99' as a dependency of your module, the module will not compile with GCC versions < 5.1.0 with

Re: undefined behaviour findings in bitset

2019-03-16 Thread Akim Demaille
> commit 4c8a35ed125e1b87a11d6aecd0b7b216384552bb > Author: Akim Demaille > Date: Sat Mar 16 17:36:22 2019 +0100 > >bitset: a bit (...) more tests > >* tests/test-bitset.c (check_attributes): Check zero and ones. > > diff --git a/tests/test-bitset.c b/tests/test-bitset.c > index 032

Re: undefined behaviour findings in bitset

2019-03-16 Thread Akim Demaille
Hi Bruno, > Le 9 mars 2019 à 20:37, Bruno Haible a écrit : > > Hi Akim, > > This one I have not fixed: > > lib/bitset/table.c:784:54: runtime error: shift exponent 87 is too large for > 64-bit type 'long unsigned int' > > To reproduce: Use gcc 8.2.0 and CC="gcc -fsanitize=undefined". Thanks

Re: undefined behaviour findings

2019-03-09 Thread Bruno Haible
> lib/des.c:552:3: runtime error: left shift of 255 by 24 places cannot be > represented in type 'int' > lib/des.c:437:3: runtime error: left shift of 242 by 24 places cannot be > represented in type 'int' > lib/des.c:625:3: runtime error: left shift of 254 by 24 places cannot be > represented i

Re: undefined behaviour findings in bitset

2019-03-09 Thread Bruno Haible
Hi Akim, This one I have not fixed: lib/bitset/table.c:784:54: runtime error: shift exponent 87 is too large for 64-bit type 'long unsigned int' To reproduce: Use gcc 8.2.0 and CC="gcc -fsanitize=undefined". Bruno