www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000206

When Created: 02/20/1998 18:29:12
Against DJGPP version: 2.01
By whom: darkstar_usa@pipeline.com
Abstract: CPP inserts spaces after #defined tokens
This is a weird bug that is not localized to even DJGPP.  All recent versions
of CPP (C preprocessor) for every operating system and CPU have this problem.

Problem:
This assembly code does not assemble:
#define asdf $1

    mov asdf,%eax

But this does:
    mov $1,%eax

The command line I'm using is gcc -fassemble-with-cpp asdf.s -o asdf.o and it's
not working.  It gives the error "operands don't match any known 386
instruction."

cpp asdf.s displays this:
# something or other
<blank>
<blank>
    mov $1 ,%eax
          ^
The space is the problem.  As this bug applies to all versions of GCC it should
be reported to the maintainers of the UNIX version.

-- Barubary

Workaround added: 02/20/1998 20:12:41
By whom: darkstar_usa@pipeline.com
I just figured out that the case of the S matters...

gcc -fassemble-with-cpp asdf.S -o asdf.o

works, but

gcc -fassemble-with-cpp asdf.s -o asdf.o

does not.  This should be fixed by having a CPP parameter that forces "assembly
parsing" mode and having -fassemble-with-cpp make GCC call CPP with that
parameter.

-- Barubary

Note added: 02/25/1998 13:01:06
By whom: broeker@physik.rwth-aachen.de
That gcc command line is about 100% wrong.

To start with, there is no '-fassemble-with-cpp' flag. The flag you're
wanting to pass is

	-x assembler-with-cpp

That's what has the exact same effect as calling the file .S instead of
.s

So, in the essence: no bug here, just incorrect use.

Closed on 04/13/1999 07:00:50: Incorrect usage, not a bug.
By whom: eliz@is.elta.co.il



  webmaster     delorie software   privacy  
  Copyright © 2010   by DJ Delorie     Updated Jul 2010