Bug 23269 - cpp incorrectly stripping out spaces
cpp incorrectly stripping out spaces
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: cpp (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-03 23:21 EST by tbeckman
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-03 23:22:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description tbeckman 2001-01-03 23:21:59 EST
The version of cpp included with RH 7.0 and the updated
cpp-2.96-69.i386.rpm that was just released both exhibit this problem.  We
use the C preprocessor to process #includes for some fortran code.  cpp
version 2.96 incorrectly strips spaces out of the resulting file, resulting
in fortran code that can not be compiled.  This same process has worked
properly with cpp from egcs-2.91.66, gcc-2.95.1 and gcc-2.95.2 (not to
mention every C preprocessor that has been used for this code from the
early 80's).  Details are below:

The following file (let's call it "temp.c") is processed through cpp with
the command line "cpp  -DFORTRAN temp.c > temp.f". 

----------------------temp.c------------------------------

#ifndef FORTRAN
static int dummy;	/* prevent ranlib from whining */
#else

C
C       WRTSTD.  Write to standard output device if different from
terminal.
C
        SUBROUTINE  WRTSTD(MSG)

        CHARACTER*(*)   MSG                     

        INTEGER         LENGTH                  
        INTEGER         LUN                     
        LOGICAL         TERMNL                  
        
        CALL GETLUN(LUN)
        CALL GETSTD(TERMNL)
        LENGTH = LEN(MSG)
        
        IF (.NOT. TERMNL) THEN
            WRITE(LUN, 100) (MSG(I:I),I=1,LENGTH)
        ENDIF
100     FORMAT(1X, 131(:,A1))
        RETURN
        END
#endif

---------------end of temp.c-----------------------

The temp.f file created  has all the spaces, except one, removed between
the "100" and the "FORMAT" from the line 
100     FORMAT(1X, 131(:,A1))

This results in g77 choking on the temp.f file.
Comment 1 Jakub Jelinek 2001-01-04 04:58:26 EST
cpp can do that, none of the C standards require it to leave the spaces in.
Use -traditional preprocessor for Fortran (g77 uses for its include directives
traditional preprocessor as well).

Note You need to log in before you can comment on or make changes to this bug.