Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 211296

Summary: media-libs/netpbm fails to build with GCC 4.3
Product: Gentoo Linux Reporter: Ryan Hill (RETIRED) <rhill>
Component: [OLD] LibraryAssignee: Gentoo Graphics Project <graphics+disabled>
Status: RESOLVED FIXED    
Severity: normal CC: ag, dschridde+gentoobugs, gregoire.favre, sebasmagri, truedfx
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 198121    
Attachments: netpbm-gcc43.patch

Description Ryan Hill (RETIRED) gentoo-dev 2008-02-24 19:02:41 UTC
I don't have a patch since I don't know MMX builtins and it seems like no one at the other distros do either ;P.  The workaround for this error is append-flags -flax-vector-conversions, which is the route it seems everyone has taken.  I would recommend we do the same until someone fixes this correctly.  This code is only triggered by -msse, so this is x86/x86_64 specific.


the error:

i686-pc-linux-gnu-gcc -Wall -c -I/var/tmp/portage/media-libs/netpbm-10.41.0/work/netpbm-10.41.0/lib -I. -Iimportinc -DNDEBUG  -O2 -g -march=prescott -fomit-frame-pointer -pipe -fPIC \
            -o libpbm3.o libpbm3.c
libpbm3.c: In function 'packBitsWithMmxSse':
libpbm3.c:107: warning: specifying vector types with __attribute__ ((mode)) is deprecated
libpbm3.c:107: warning: use __attribute__ ((vector_size)) instead
libpbm3.c:116: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts
libpbm3.c:116: error: incompatible type for argument 1 of '__builtin_ia32_pcmpeqb'
libpbm3.c:116: error: incompatible type for argument 2 of '__builtin_ia32_pcmpeqb'
libpbm3.c:116: error: incompatible types in initialization
libpbm3.c:118: error: incompatible type for argument 1 of '__builtin_ia32_pmovmskb'
make[1]: *** [libpbm3.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/media-libs/netpbm-10.41.0/work/netpbm-10.41.0/lib'


the code if anyone wants to look at this:

    typedef int v8qi __attribute__ ((mode(V8QI)));
    typedef int di __attribute__ ((mode(DI)));

    di const zero64 = 0;        /* to clear with PXOR */

    unsigned int col;

    for (col = 0; col + 7 < cols; col += 8) {
        v8qi const compare =
            __builtin_ia32_pcmpeqb(*(v8qi*) (&bitrow[col]), *(v8qi*) &zero64);
        unsigned char const backwardWhiteMask = (unsigned char)
            __builtin_ia32_pmovmskb(compare);
        unsigned char const backwardBlackMask = ~backwardWhiteMask;
        unsigned char const blackMask = bitreverse[backwardBlackMask];

        packedBits[col/8] = blackMask;
    }



To prevent the deprecated warning change
    typedef int v8qi __attribute__ ((mode(V8QI)));
to
    typedef int v8qi __attribute__ ((vector_size(8)));
Comment 1 Harald van Dijk (RETIRED) gentoo-dev 2008-02-25 20:14:53 UTC
Looks like it simply needs
  typedef char v8qi __attribute__ ((vector_size(8)));

I've checked that the resulting netpbm still works using
  netpbm pbmtoatk testgrid.pbm | netpbm atktopbm - | diff testgrid.pbm -
(and verified that the modified code gets executed by atktopbm)
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2008-02-25 20:32:35 UTC
Created attachment 144639 [details, diff]
netpbm-gcc43.patch

In a nice patch format...
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2008-02-26 00:37:56 UTC
i thought the base type was ignored when defining vector types with builtins.
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2008-02-26 00:42:07 UTC
ahhh.  it helps if the manual i'm looking at isn't for 3.4.4.  :P

thanks!
Comment 5 Grégoire Favre 2008-03-28 17:06:06 UTC
Any idea why this patch isn't included as it works just like a charm ?
I know gcc-4.3.x isn't really in portage, but it will prepare the future, no ?
Comment 6 SpanKY gentoo-dev 2008-03-28 18:22:03 UTC
learn a little bit of patience please
Comment 7 Grégoire Favre 2008-03-28 18:55:58 UTC
Well, I am not complaining... so either my english is too bad and I didn't wrote what I am feeling, or ???

Anyway, thank for the patch :-)
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2008-06-16 15:11:43 UTC
*** Bug 227451 has been marked as a duplicate of this bug. ***