Bug 57017 - «Error: expecting string instruction after `rep'» in code w/o inline assembly
Summary: «Error: expecting string instruction after `rep'» in code w/o inline assembly
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-20 21:01 UTC by Alan Aversa
Modified: 2013-04-25 07:27 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-slackware-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-04-21 00:00:00


Attachments
the preprocessed C source file (2.00 KB, text/x-csrc)
2013-04-21 03:57 UTC, Alan Aversa
Details
the REAL preprocessed source file (12.86 KB, text/x-csrc)
2013-04-24 05:58 UTC, Alan Aversa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Aversa 2013-04-20 21:01:38 UTC
Compiling code without inline assembly gives an error:

libtool: compile:  gcc -std=gnu99 -DPACKAGE_NAME=\"libblkmaker\" -DPACKAGE_TARNAME=\"libblkmaker\" -DPACKAGE_VERSION=\"0.1\" "-DPACKAGE_STRING=\"libblkmaker 0.1\"" -DPACKAGE_BUGREPORT=\"luke_libblkmaker@dashjr.org\" -DPACKAGE_URL=\"http://gitorious.org/bitcoin/libblkmaker\" -DPACKAGE=\"libblkmaker\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -O3 -O3 -MT blkmaker.lo -MD -MP -MF .deps/blkmaker.Tpo -c blkmaker.c  -fPIC -DPIC -o .libs/blkmaker.o
/tmp/ccot8mMw.s: Assembler messages:
/tmp/ccot8mMw.s:529: Error: expecting string instruction after `rep'

However, disabling inline assembly "-fno-asm" only fixes the problem when "-O3" is not used. The error always occurs when not specifying "-fno-asm".
Comment 1 Andrew Pinski 2013-04-20 21:44:50 UTC
Can you attach the preprocessed source?
Comment 2 Alan Aversa 2013-04-21 03:57:56 UTC
Created attachment 29907 [details]
the preprocessed C source file
Comment 3 Andrew Pinski 2013-04-21 03:59:55 UTC
(In reply to comment #2)
> Created attachment 29907 [details]
> the preprocessed C source file

This cannot be the preprocessed source as it still includes #include in it.
Comment 4 Alan Aversa 2013-04-24 05:58:29 UTC
Created attachment 29925 [details]
the REAL preprocessed source file

sorry, I uploaded the wrong file; this is the preprocessed source file
Comment 5 Andrew Pinski 2013-04-24 06:09:02 UTC
What binutils version are you using?  You can find out by doing "as --version".  

I think this is a bug in the version of binutils you are using the generated assembly is:
"        rep; ret " which is a valid assembly for x86_64.
Comment 6 Jakub Jelinek 2013-04-24 06:15:46 UTC
Can't reproduce, perhaps misconfigured compiler?
HAVE_AS_IX86_REP_LOCK_PREFIX test in particular.  You haven't said what target it is and how you've configured the compiler...
Comment 7 Alan Aversa 2013-04-24 06:22:54 UTC
(In reply to comment #5)
> What binutils version are you using?  You can find out by doing "as --version". 
> 
> I think this is a bug in the version of binutils you are using the generated
> assembly is:
> "        rep; ret " which is a valid assembly for x86_64.

GNU assembler (Linux/GNU Binutils) 2.22.52.0.2.20120424

(In reply to comment #6)
> Can't reproduce, perhaps misconfigured compiler?
> HAVE_AS_IX86_REP_LOCK_PREFIX test in particular.  You haven't said what target
> it is and how you've configured the compiler...

../gcc-4.8.0/configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap --enable-languages=ada,c,c++,fortran,go,java,lto,objc --enable-threads=posix --enable-checking=release --enable-objc-gc --with-system-zlib --with-python-dir=/lib64/python2.7/site-packages --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib64/jvm/jre --with-jvm-root-dir=/usr/lib64/jvm --with-jvm-jar-dir=/usr/lib64/jvm/jvm-exports --with-arch-directory=amd64 --with-antlr-jar=/home/slackware/slackbuilds/gcc/antlr-runtime-3.4.jar --enable-multilib --target=x86_64-slackware-linux --build=x86_64-slackware-linux --host=x86_64-slackware-linux
Comment 8 Alan Aversa 2013-04-25 02:53:02 UTC
I upgraded to binutils 2.23.52.0.1 and the problem went away.
Comment 9 Jakub Jelinek 2013-04-25 07:27:18 UTC
Not a bug in gcc then.