From the gcc man page:

-S  Stop after the stage of compilation proper; do not
    assemble.  The output is in the form of an assembler
    code file for each non-assembler input file specified.

    By default, the assembler file name for a source file
    is made by replacing the suffix .c, .i, etc., with .s.

    Input files that don't require compilation are

Any C compiler should be able to generate assembly code; after all, it is one of the four steps in producing an executable (the other three being preprocessing, the actual assembling into object code, and linking the object code). Plus, assembly is more or less just a more human-readable version of machine language, which is exactly what the compiler is supposed to make, so if there's a C compiler that can't provide assembly output, it must be using pure voodoo to produce the executable. (Ok, not 100% of the time. Call says the Norcroft ARM compiler doesn't normally make assembly code -- however, it can disassemble the object code to produce the assembly.)

On a side note, this can help to make learning assembly programming easier, but converting C to assembly does not an assembly programmer make: the output is likely to be awkward and difficult (if not next to impossible) to read and understand, especially when one is still trying to grasp the basic concepts of assembly language programming.

Log in or register to write something here or to contact authors.