#1828 incorrect error messages


The declaration: "extern __code char * _code channels[ 8 ];" in a header file caues the compiler to generate a bogus error:

Invoking project defined compiler.
c:\SDCC\BIN\SDCC.EXE -c --debug --use-stdout -V --model-large --iram-size 256 --xram-size 8192 -I"D:\Lucid\TestEqip\03997\soft\Hardware Checkout" "D:\Lucid\TestEqip\03997\soft\Hardware Checkout\hello.c"

+ c:\SDCC\BIN\sdcpp.exe -nostdinc -Wall -I"D:\Lucid\TestEqip\03997\soft\Hardware Checkout" -obj-ext=.rel -DSDCC_MODEL_LARGE -DSDCC_FLOAT_REENT -DSDCC=300 -DSDCC_REVISION=6037 -DSDCC_mcs51 -D__mcs51 -isystem "c:\SDCC\BIN\..\include\mcs51" -isystem "c:\SDCC\BIN\..\include" "D:\Lucid\TestEqip\03997\soft\Hardware Checkout\hello.c"
sdcpp.exe: fatal error: when writing output to : No such file or directory

D:\Lucid\TestEqip\03997\soft\Hardware Checkout\/adc.h:3: syntax error: token -> 'channels' ; column 35

The original problem is that there's an underscore missing from the second code declaration.


  • Scott Grodevant

    Scott Grodevant - 2011-08-26
  • Raphael Neider

    Raphael Neider - 2011-08-26
    • labels: 638148 --> C-Front End
    • milestone: --> 100455
    • status: open --> pending-invalid
  • Raphael Neider

    Raphael Neider - 2011-08-26

    extern __code char * _code[8];
    would be a perfectly valid, legal declaration of an array named _code. The syntax error message is correct in that the token channels after the identifier _code cannot complete a valid element of the C language. While we could try to make the error message more helpful (request for enhancement / feature request), this is not a bug.

    The first message from sdcpp worries me: Is this caused by the blank in the pathname? Or is sdcpp trying something strange here? The blank between "to" and ":" seems to suggest an empty output filename?!? Anyways, since you are reporting a different problem and since sdcc seems to have gotten back some output from sdcpp, we will ignore this for now ;-)

    I set this item to pending so that it close automatically unless someone responds within the next few days.

    Best regards


  • Scott Grodevant

    Scott Grodevant - 2011-08-30
    • status: pending-invalid --> open-invalid
  • Scott Grodevant

    Scott Grodevant - 2011-08-30

    The incorrect formatting of the command line is a direct result of the error in the code (e.g. the missing underscore). That's the bug I'm talking about. The syntax error was close enough to lead me to the problem, but the fatal error writing output seems a totally unrelated consequence of the code formatting problem.

  • Borut Ražem

    Borut Ražem - 2011-09-11

    I tried to reproduce it with:

    sdcc --version
    SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 3.0.4 #6848 (Sep
    10 2011) (MINGW32)

    but I get only the second error message:
    adc.h:3: syntax error: token -> 'channels' ; column 35
    which is OK.

    Scott, can you please re-verify if it is still reproducible in build #6848 or newer?


  • Borut Ražem

    Borut Ražem - 2011-09-11
    • milestone: 100455 --> unreproducable
    • assigned_to: nobody --> borutr
    • status: open-invalid --> pending-works-for-me
  • Scott Grodevant

    Scott Grodevant - 2011-09-12

    I just installed build 6849. I am running SDCC via SiLabs IDE (3.80.00). When presented with good souce code, it compiles fine. When I remove one of the double underscores from any of the __code keywords, it hangs. A dialog "Preparing code for d..." is displayed, which never disappears. If I terminate the process using task manager to terminate SDCC, then fix the code, it again compiles.

    If I run SDCC from a command prompt, I do get the same sort of message you show below, but SDCC doesn't terminate, it remains active. Did you notice that SDCC doesn't terminate?


  • Scott Grodevant

    Scott Grodevant - 2011-09-12
    • status: pending-works-for-me --> open-works-for-me
  • Borut Ražem

    Borut Ražem - 2011-09-12

    No, in may case it doesn't hang:

    N:\tmp\cpp>sdcc -c --debug --use-stdout -V --model-large --iram-size 256 --xram-
    size 8192 -I"D:\Lucid\TestEqip\03997\soft\Hardware Checkout" t.c
    + C:\PROGRA~1\SDCC\bin\sdcpp.exe -nostdinc -Wall -ID:\\Lucid\\TestEqip\\03997\\s
    oft\\Hardware" "Checkout -obj-ext=.rel -DSDCC_MODEL_LARGE -DSDCC_FLOAT_REENT -DS
    DCC=304 -DSDCC_REVISION=6849 -DSDCC_mcs51 -D__mcs51 -isystem "C:\Program Files\S
    DCC\bin\..\include\mcs51" -isystem "C:\Program Files\SDCC\bin\..\include" "t.c"

    adc.h:3: syntax error: token -> 'channels' ; column 35


    The content of t.c is:

    #include "adc.h"

    int main()
    return 0;

    Try to compile it from the current directory, in you case from "D:\Lucid\TestEqip\03997\soft\Hardware Checkout".

    Try to move both adc.h and t.c to a directory on disk C: and try to compile them from the command line.

    Let me know about the results.


  • Borut Ražem

    Borut Ražem - 2011-10-16
    • status: open-works-for-me --> pending-works-for-me
  • Philipp Klaus Krause

    • status: pending-works-for-me --> closed-out-of-date
    • Category: --> other

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks