[Libwebsockets] Configure error

"Andy Green (林安廸)" andy at warmcat.com
Tue Jan 15 15:35:14 CET 2013


On 15/01/13 22:31, the mail apparently from Jack Mitchell included:
> On 15/01/13 14:24, Jack Mitchell wrote:
>> On 15/01/13 14:21, "Andy Green (林安廸)" wrote:
>>> On 15/01/13 22:08, the mail apparently from Jack Mitchell included:
>>>
>>> Wow...
>>>
>>>> test-server.c: In function ‘callback_http’:
>>>> test-server.c:243:50: error: array subscript is above array bounds
>>>> [-Werror=array-bounds]
>>>> test-server.c:244:47: error: array subscript is above array bounds
>>>> [-Werror=array-bounds]
>>>
>>> huh... that's
>>>
>>>     pollfd_maps[hash][n].index =
>>> pollfd_maps[hash][pollfd_count[hash]].index;
>>>     pollfd_maps[hash][n].fd = pollfd_maps[hash][pollfd_count[hash]].fd;
>>>
>>> all of the array indexes are variables...
>>>
>>> For the compiler to think it could say there was a problem either
>>> hash or n would have to have been resolved to be (a big) constant.
>>>
>>> I'm not really seeing how that can be legit when it compiles here on
>>> gcc 4.7.2 with pedantic and Wall Werror (and works then).
>>>
>>> Is the compiler a bit new or anything?
>>>
>>> -Andy
>>>
>>
>> [jack at archHP ~]$ gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
>>
>> Target: x86_64-unknown-linux-gnu
>> Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr
>> --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
>> --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
>> --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++
>> --enable-shared --enable-threads=posix --with-system-zlib
>> --enable-__cxa_atexit --disable-libunwind-exceptions
>> --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time
>> --enable-gnu-unique-object --enable-linker-build-id --with-ppl
>> --enable-cloog-backend=isl --disable-ppl-version-check
>> --disable-cloog-version-check --enable-lto --enable-gold
>> --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold
>> --with-linker-hash-style=gnu --disable-multilib --disable-libssp
>> --disable-build-with-cxx --disable-build-poststage1-with-cxx
>> --enable-checking=release
>> Thread model: posix
>> gcc version 4.7.2 (GCC)
>>
>> I can say that it builds fine in my cross compile environment which is
>> also GCC 4.7.2 but it is a completely different tool chain to my
>> x86_64 box.
>>
>
> --without-testapps allows it to build fine, so the issue is only present
> in the test-servers.

Yes the error is only in test-server.c, but the code there is OK.

I am afraid this is a compiler bug and I didn't see a nice way to work 
around it.  However not compiling it with that compiler via 
--without-testapps will do if you're OK with that.

-Andy




More information about the Libwebsockets mailing list