• Bug#265917: scorched3d: FTBFS on amd64: 64 bit issues.

    From Kurt Roeckx@1:229/2 to All on Sun Aug 15 20:30:09 2004
    From: [email protected]

    Package: scorched3d
    Version: 37.2-4
    Severity: important

    The package FTBFS on amd64. This is actually caused by a bug in
    the compiler who doesn't like doing integer arithmetic on an
    "int" (32 bit) and then convert it too pointer again (64 bit).

    The code in question is:
    #define EFFICIENT_ALIGNMENT 16

    #define dEFFICIENT_SIZE(x) ((((x)-1)|(EFFICIENT_ALIGNMENT-1))+1)

    #define dALLOCA16(n) \
    ((char*)dEFFICIENT_SIZE(((int)(alloca((n)+(EFFICIENT_ALIGNMENT-1))))))

    This seems to be ugly and non-portable code. Not only is it
    using a function that's discouraged not to be used, it then goes
    and modifies the returned address.

    It casts to an int. On a 64 bit system this can be a 32 bit
    integer so your pointer gets corrupted. I suggest you use
    C99's intptr_t which you should get by including <stdint.h>.
    You should probably change configure to give a suitable
    replacement in case it's not found.
    With this change I'm able to compile it on amd64, no idea if it
    runs.

    An better way to solve this would be by replacing it by
    posix_memalign() if available, which would also require the use
    of free().

    There are lots of other warnings about casts from int to pointer
    or pointer to int of different size. Some of them might be a
    problem, some might not be.


    Kurt



    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)