[FFmpeg-cvslog] r12620 - trunk/configure

Måns Rullgård mans
Sat Mar 29 23:00:51 CET 2008


"?smail D?nmez" <ismail at namtrac.org> writes:

> On Sat, Mar 29, 2008 at 10:09 PM, ?smail D?nmez <ismail at namtrac.org> wrote:
>> On Sat, Mar 29, 2008 at 10:02 PM, matthieu castet
>>
>>
>> <castet.matthieu at free.fr> wrote:
>>  >
>>  > ?smail D?nmez wrote:
>>  >  > On Fri, Mar 28, 2008 at 10:04 PM, matthieu castet
>>  >  > <castet.matthieu at free.fr> wrote:
>>  >  >> diego wrote:
>>  >  >>  > Author: diego
>>  >  >>  > Date: Fri Mar 28 12:53:37 2008
>>  >  >>  > New Revision: 12620
>>  >  >>  >
>>  >  >>  > Log:
>>  >  >>  > Replace hackish CFLAGS 64 bit test by a proper compilation check.
>>  >  >>  > patch by ?smail D?nmez, ismail namtrac org
>>  >  >>  >
>>  >  >>  >
>>  >  >>  > Modified:
>>  >  >>  >    trunk/configure
>>  >  >>  >
>>  >  >>  > Modified: trunk/configure
>>  >  >>  > ==============================================================================
>>  >  >>
>>  >  >>> +        check_cc <<EOF && enable fast_64bit && arch="x86_64"
>>  >  >>  > +        int test[sizeof(char*) - 7];
>>  >  >>  > +EOF
>>  >  >>  Just for info gcc see "sizeof(char*) - 7" as a big integer not a
>>  >  >>  negative integer.
>>  >  >>
>>  >  >>  The check still failed on 32 bits because of array
>>  >  >>  overflow. I wonder if it was the expected behaviour.
>>  >  >
>>  >  > Yes thats the point, it won't compile on 32bit. Thats why we
>>  >  > use check_cc.
>>  >  my point was is there something in C standard that prevent to allocate
>>  >  such big array ?
>>  >
>>  >  Yes gcc failed because of array overflow, but not all C
>>  >  compiler are gcc.
>>  >
>>  >  May be it could be more safe to make "sizeof(char*) - 7" signed and be
>>  >  in the case of negative array (which is in the C standard).
>>
>>  sizeof(char*) is 4 on 32bit so you are trying to do int test[-3] which
>>  should fail on all valid compilers.
>
> Ah so gcc wraps that to an unsigned number, I see. Would
> (signed)(sizeof(char*) - 7) work for everyone?

Make that (signed)sizeof(char*) - 7.  It's still wrong on 64-bit
systems with 32-bit pointers, though.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list