CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-13 Thread O. Hartmann
Trying to recompile converters/libiconv on FreeBSD 10.0-CUR/r49438 (with
bran new CLANG 3.3) results  with the errors below. This error shows up
on boxes having FBSD 10 and X11. It doesn't show up on those boxes
running without a full X11 (that is the only difference I can figure out
at the moment since the different systems share a lot of configuration
stuff, having different CPU types (C2D, Sandy-Bridge, Ivy-Bridge) but
nothing I can figure out as the source of the strange behaviour and
error).

Maybe someone has a hint what this could be ...

Thanks in advance and regards,
Oliver

converters/libiconv:

[...]
rm -f unitypes.h-t unitypes.h &&  { echo '/* DO NOT EDIT! GENERATED
AUTOMATICALLY! */';  cat ./unitypes.in.h;  } > unitypes.h-t &&  mv -f
unitypes.h-t unitypes.h
rm -f uniwidth.h-t uniwidth.h &&  { echo '/* DO NOT EDIT! GENERATED
AUTOMATICALLY! */';  cat ./uniwidth.in.h;  } > uniwidth.h-t &&  mv -f
uniwidth.h-t uniwidth.h
make  all-am
cc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib  -I../intl
-DDEPENDS_ON_LIBICONV=1  -DDEPENDS_ON_LIBINTL=1-O2 -pipe -O3
-march=native -fno-strict-aliasing -c allocator.c
cc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib  -I../intl
-DDEPENDS_ON_LIBICONV=1  -DDEPENDS_ON_LIBINTL=1-O2 -pipe -O3
-march=native -fno-strict-aliasing -c areadlink.c
In file included from areadlink.c:27:
In file included from ./careadlinkat.h:23:
In file included from ./fcntl.h:62:
./unistd.h:694:5: error: invalid token at start of a preprocessor
expression
#if @GNULIB_EUIDACCESS@
^
1 error generated.
*** [areadlink.o] Error code 1

Stop in /usr/ports/converters/libiconv/work/libiconv-1.14/srclib.
*** [all] Error code 1

Stop in /usr/ports/converters/libiconv/work/libiconv-1.14/srclib.
*** [all] Error code 1

Stop in /usr/ports/converters/libiconv/work/libiconv-1.14.
*** [do-build] Error code 1

Stop in /usr/ports/converters/libiconv.
*** [install] Error code 1

Stop in /usr/ports/converters/libiconv.
*** [reinstall] Error code 1

Stop in /usr/ports/converters/libiconv.



signature.asc
Description: This is a digitally signed message part


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-15 Thread Jan Beich
"O. Hartmann"  writes:

> Trying to recompile converters/libiconv on FreeBSD 10.0-CUR/r49438 (with
> bran new CLANG 3.3) results  with the errors below. This error shows up
> on boxes having FBSD 10 and X11. It doesn't show up on those boxes
> running without a full X11 (that is the only difference I can figure out
> at the moment since the different systems share a lot of configuration
> stuff, having different CPU types (C2D, Sandy-Bridge, Ivy-Bridge) but
> nothing I can figure out as the source of the strange behaviour and
> error).
[...]
> converters/libiconv:
> cc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib  -I../intl
> -DDEPENDS_ON_LIBICONV=1  -DDEPENDS_ON_LIBINTL=1-O2 -pipe -O3
> -march=native -fno-strict-aliasing -c areadlink.c
> In file included from areadlink.c:27:
> In file included from ./careadlinkat.h:23:
> In file included from ./fcntl.h:62:
> ./unistd.h:694:5: error: invalid token at start of a preprocessor
> expression
> #if @GNULIB_EUIDACCESS@
> ^
> 1 error generated.

Maybe -O3 overoptimizes regex in libc e.g.,

$ echo '#if @GNULIB_EUIDACCESS@' | sed 's/@GNULIB_EUIDACCESS@/0/'
#if @GNULIB_EUIDACCESS@

$ echo 'xxx' | sed 's/xxx//'
xxx
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-16 Thread Dimitry Andric
On Apr 16, 2013, at 00:42, Jan Beich  wrote:
> "O. Hartmann"  writes:
>> ./unistd.h:694:5: error: invalid token at start of a preprocessor
>> expression
>> #if @GNULIB_EUIDACCESS@
>>^
>> 1 error generated.
> 
> Maybe -O3 overoptimizes regex in libc e.g.,
> 
> $ echo '#if @GNULIB_EUIDACCESS@' | sed 's/@GNULIB_EUIDACCESS@/0/'
> #if @GNULIB_EUIDACCESS@
> 
> $ echo 'xxx' | sed 's/xxx//'
> xxx

How did you arrive at this result?  I have recompiled both libc and sed
with -O3, but it works just fine here.  Maybe -march=native is the clue,
so which kind of CPU do you have?  To see what CPU llvm detects, try:

  tblgen -version | grep CPU

Note that -O3 turns on clang's vectorizer, so you might have run into an
optimizer bug, or some kind of undefined behavior which now falls over.

-Dimitry

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-16 Thread O. Hartmann
On Tue, 2013-04-16 at 20:58 +0200, Dimitry Andric wrote:
> On Apr 16, 2013, at 00:42, Jan Beich  wrote:
> > "O. Hartmann"  writes:
> >> ./unistd.h:694:5: error: invalid token at start of a preprocessor
> >> expression
> >> #if @GNULIB_EUIDACCESS@
> >>^
> >> 1 error generated.
> > 
> > Maybe -O3 overoptimizes regex in libc e.g.,
> > 
> > $ echo '#if @GNULIB_EUIDACCESS@' | sed 's/@GNULIB_EUIDACCESS@/0/'
> > #if @GNULIB_EUIDACCESS@
> > 
> > $ echo 'xxx' | sed 's/xxx//'
> > xxx
> 
> How did you arrive at this result?  I have recompiled both libc and sed
> with -O3, but it works just fine here.  Maybe -march=native is the clue,
> so which kind of CPU do you have?  To see what CPU llvm detects, try:
> 
>   tblgen -version | grep CPU
> 
> Note that -O3 turns on clang's vectorizer, so you might have run into an
> optimizer bug, or some kind of undefined behavior which now falls over.
> 
> -Dimitry
> 
 tblgen -version | grep CPU:

Host CPU: penryn (host A)
Host CPU: core-avx-i (host B)
Host CPU: corei7-avx (host C)

and the problem occurs on all of those boxes running most recent FreeBSD
10.0-CURRENT with CLANG 3.3



signature.asc
Description: This is a digitally signed message part


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-16 Thread Jan Beich
Dimitry Andric  writes:

> On Apr 16, 2013, at 00:42, Jan Beich  wrote:
>
>> "O. Hartmann"  writes:
>>> ./unistd.h:694:5: error: invalid token at start of a preprocessor
>>> expression
>>> #if @GNULIB_EUIDACCESS@
>>>^
>>> 1 error generated.
>> 
>> Maybe -O3 overoptimizes regex in libc e.g.,
>> 
>> $ echo '#if @GNULIB_EUIDACCESS@' | sed 's/@GNULIB_EUIDACCESS@/0/'
>> #if @GNULIB_EUIDACCESS@
>> 
>> $ echo 'xxx' | sed 's/xxx//'
>> xxx
>
> How did you arrive at this result?

1/ chroot into poudriere jail for /head amd64
2/ echo CFLAGS+=-O3 >> /etc/make.conf
3/ make -j2 (in /usr/src/lib/libc)
4/ prepend LD_LIBRARY_PATH=. before sed(1)
5/ rebuild regcomp.o, regcomp.So with -O2 to confirm

> I have recompiled both libc and sed
> with -O3, but it works just fine here.

> Maybe -march=native is the clue, so which kind of CPU do you have?

sse2 is available on amd64 even without -march=. But I can't reproduce
the issue on i386 even with -march=native.

> To see what CPU llvm detects, try:
>
>   tblgen -version | grep CPU

  Host CPU: penryn

>
> Note that -O3 turns on clang's vectorizer, so you might have run into an
> optimizer bug, or some kind of undefined behavior which now falls over.

My luck is poor even with -O2 e.g., firefox20 crash on stackoverflow.com

[New LWP 101222]
[New Thread 801b02400 (LWP 101222)]
[New Thread 81060e800 (LWP 101372 StreamTrans #1)]
[New Thread 810ee8800 (LWP 101373 DOM Worker)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 801b02400 (LWP 101222)]
PodCopy (dst=, nelem=,
src=, dst=, src=,
nelem=) at ../../../js/src/jsutil.h:238
238 PodAssign(dst, src);
(gdb) bt
#0  PodCopy (dst=, nelem=,
src=, dst=, src=,
nelem=) at ../../../js/src/jsutil.h:238
#1  getCallFrame (cx=, flags=, fun=,
report=(unknown: 2266652928), this=, args=..., script=...)
at ../../../js/src/vm/Stack-inl.h:454
#2  getFixupFrame (cx=, initial=,
fun=, ncode=, dummy=0, report=,
this=, cx=, report=, args=...,
fun=, script=..., ncode=,
initial=, stackLimit=)
at ../../../js/src/vm/Stack-inl.h:513
#3  js::mjit::stubs::FixupArity (f=..., nactual=4294945312)
at 
/wrkdirs/usr/ports/www/firefox/work/mozilla-release/js/src/methodjit/InvokeHelpers.cpp:213
#4  0x0008019c48c2 in ?? ()
#5  0x0008019b56b8 in ?? ()
#6  0x0001 in ?? ()
#7  0x in ?? ()

>
> -Dimitry
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-17 Thread Dimitry Andric
On Apr 17, 2013, at 07:31, Jan Beich  wrote:
> Dimitry Andric  writes:
> On Apr 16, 2013, at 00:42, Jan Beich  wrote:
...
>>> Maybe -O3 overoptimizes regex in libc e.g.,
>>> 
>>> $ echo '#if @GNULIB_EUIDACCESS@' | sed 's/@GNULIB_EUIDACCESS@/0/'
>>> #if @GNULIB_EUIDACCESS@
>>> 
>>> $ echo 'xxx' | sed 's/xxx//'
>>> xxx
>> 
>> How did you arrive at this result?
> 
> 1/ chroot into poudriere jail for /head amd64
> 2/ echo CFLAGS+=-O3 >> /etc/make.conf
> 3/ make -j2 (in /usr/src/lib/libc)
> 4/ prepend LD_LIBRARY_PATH=. before sed(1)
> 5/ rebuild regcomp.o, regcomp.So with -O2 to confirm

I have been able to reproduce this on amd64, with -O3, but not on i386.
It seems regcomp() is either miscompiled at -O3, or it contains some bug
triggered only by the vectorizer.  I am still investigating.


> My luck is poor even with -O2 e.g., firefox20 crash on stackoverflow.com
> 
> [New LWP 101222]
> [New Thread 801b02400 (LWP 101222)]
> [New Thread 81060e800 (LWP 101372 StreamTrans #1)]
> [New Thread 810ee8800 (LWP 101373 DOM Worker)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 801b02400 (LWP 101222)]
> PodCopy (dst=, nelem=,
>src=, dst=, src=,
>nelem=) at ../../../js/src/jsutil.h:238
> 238 PodAssign(dst, src);
> (gdb) bt
> #0  PodCopy (dst=, nelem=,
>src=, dst=, src=,
>nelem=) at ../../../js/src/jsutil.h:238
> #1  getCallFrame (cx=, flags=, fun= out>,
>report=(unknown: 2266652928), this=, args=..., script=...)
>at ../../../js/src/vm/Stack-inl.h:454
> #2  getFixupFrame (cx=, initial=,
>fun=, ncode=, dummy=0, report= out>,
>this=, cx=, report=, args=...,
>fun=, script=..., ncode=,
>initial=, stackLimit=)
>at ../../../js/src/vm/Stack-inl.h:513
> #3  js::mjit::stubs::FixupArity (f=..., nactual=4294945312)
>at 
> /wrkdirs/usr/ports/www/firefox/work/mozilla-release/js/src/methodjit/InvokeHelpers.cpp:213
> #4  0x0008019c48c2 in ?? ()
> #5  0x0008019b56b8 in ?? ()
> #6  0x0001 in ?? ()
> #7  0x in ?? ()

This is a completely different issue.  Is there any way you can reduce
the test case?  Or maybe upstream has already fixed it?

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-17 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2013-04-17 06:07:47 -0400, Dimitry Andric wrote:
> On Apr 17, 2013, at 07:31, Jan Beich  wrote:
>> Dimitry Andric  writes: On Apr 16, 2013, at
>> 00:42, Jan Beich  wrote:
> ...
 Maybe -O3 overoptimizes regex in libc e.g.,
 
 $ echo '#if @GNULIB_EUIDACCESS@' | sed
 's/@GNULIB_EUIDACCESS@/0/' #if @GNULIB_EUIDACCESS@
 
 $ echo 'xxx' | sed
 's/xxx//' xxx
>>> 
>>> How did you arrive at this result?
>> 
>> 1/ chroot into poudriere jail for /head amd64 2/ echo CFLAGS+=-O3
>> >> /etc/make.conf 3/ make -j2 (in /usr/src/lib/libc) 4/ prepend
>> LD_LIBRARY_PATH=. before sed(1) 5/ rebuild regcomp.o, regcomp.So
>> with -O2 to confirm
> 
> I have been able to reproduce this on amd64, with -O3, but not on
> i386. It seems regcomp() is either miscompiled at -O3, or it
> contains some bug triggered only by the vectorizer.  I am still
> investigating.
...

With "-fno-vectorize", this problem doesn't seem to happen.

FYI,

Jung-uk Kim
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (FreeBSD)

iQEcBAEBAgAGBQJRbvUHAAoJECXpabHZMqHOekEIAIml2te9436LzTFsr794y82E
Vmytl95H+vW9Nj0qK5X/DkB/0MSepL5FZqKF5CSNTXFoNJoVFewYRIH/H5oICSpZ
jfS4evF9i2mEDOScTyC/XaucvcVWupLE9Kf7FHEk5YIhDMs4r4nzwMFGkzffEqPK
yLkV/Cpc8xjvi28OuXd1KaPIcX3S8Z9vEmWPyljtseRv9WlC5gT44fSz18hmqYmv
fWSiML4YKKkDRAPOCy/Shpf5QUcygOul7Jz8RiDBx3O4R5goGW8Ee8Napn7UulSL
nAXTHy8dcSbiAqqPKeXhmZGPCotj++P9s3jEvunOxL7lvrdjfy3WtGedcp02ia8=
=jwYS
-END PGP SIGNATURE-
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-23 Thread Dimitry Andric
On Apr 17, 2013, at 21:16, Jung-uk Kim  wrote:
> On 2013-04-17 06:07:47 -0400, Dimitry Andric wrote:
>> On Apr 17, 2013, at 07:31, Jan Beich  wrote:
>>> Dimitry Andric  writes: On Apr 16, 2013, at
>>> 00:42, Jan Beich  wrote:
>> ...
> Maybe -O3 overoptimizes regex in libc e.g.,
> 
> $ echo '#if @GNULIB_EUIDACCESS@' | sed
> 's/@GNULIB_EUIDACCESS@/0/' #if @GNULIB_EUIDACCESS@
> 
> $ echo 'xxx' | sed
> 's/xxx//' xxx
 
 How did you arrive at this result?
>>> 
>>> 1/ chroot into poudriere jail for /head amd64 2/ echo CFLAGS+=-O3
> /etc/make.conf 3/ make -j2 (in /usr/src/lib/libc) 4/ prepend
>>> LD_LIBRARY_PATH=. before sed(1) 5/ rebuild regcomp.o, regcomp.So
>>> with -O2 to confirm
>> 
>> I have been able to reproduce this on amd64, with -O3, but not on
>> i386. It seems regcomp() is either miscompiled at -O3, or it
>> contains some bug triggered only by the vectorizer.  I am still
>> investigating.
> ...
> 
> With "-fno-vectorize", this problem doesn't seem to happen.

After some more investigation, I submitted LLVM PR 15830, with a test
case reduced from our regcomp.c.  It got diagnosed and fixed pretty
quickly, and I have pulled in the fix in r249817.  Please verify it, by
rebuilding libc with your original -O3 settings; the sed commands listed
above should now work correctly.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: CURRENT (r249438): (devel/libiconv)./unistd.h:686:5: error: invalid token at start of a preprocessor expression : #if @GNULIB_EUIDACCESS@

2013-04-24 Thread O. Hartmann
On Tue, 2013-04-23 at 21:03 +0200, Dimitry Andric wrote:
> On Apr 17, 2013, at 21:16, Jung-uk Kim  wrote:
> > On 2013-04-17 06:07:47 -0400, Dimitry Andric wrote:
> >> On Apr 17, 2013, at 07:31, Jan Beich  wrote:
> >>> Dimitry Andric  writes: On Apr 16, 2013, at
> >>> 00:42, Jan Beich  wrote:
> >> ...
> > Maybe -O3 overoptimizes regex in libc e.g.,
> > 
> > $ echo '#if @GNULIB_EUIDACCESS@' | sed
> > 's/@GNULIB_EUIDACCESS@/0/' #if @GNULIB_EUIDACCESS@
> > 
> > $ echo 'xxx' | sed
> > 's/xxx//' xxx
>  
>  How did you arrive at this result?
> >>> 
> >>> 1/ chroot into poudriere jail for /head amd64 2/ echo CFLAGS+=-O3
> > /etc/make.conf 3/ make -j2 (in /usr/src/lib/libc) 4/ prepend
> >>> LD_LIBRARY_PATH=. before sed(1) 5/ rebuild regcomp.o, regcomp.So
> >>> with -O2 to confirm
> >> 
> >> I have been able to reproduce this on amd64, with -O3, but not on
> >> i386. It seems regcomp() is either miscompiled at -O3, or it
> >> contains some bug triggered only by the vectorizer.  I am still
> >> investigating.
> > ...
> > 
> > With "-fno-vectorize", this problem doesn't seem to happen.
> 
> After some more investigation, I submitted LLVM PR 15830, with a test
> case reduced from our regcomp.c.  It got diagnosed and fixed pretty
> quickly, and I have pulled in the fix in r249817.  Please verify it, by
> rebuilding libc with your original -O3 settings; the sed commands listed
> above should now work correctly.

Both the ports devel/libiconv and graphics/jasper do not show the
reported error anymore after this patch!

Thanks for helping fixing this that fast!

With regards,
Oliver


signature.asc
Description: This is a digitally signed message part