Menu

#2629 invalid error 78: incompatible types

closed-fixed
None
Front-end
5
2022-04-15
2017-07-15
No

From forum [fbea223c] the following code:

const char* const pcTaskStartMsg = "LED flash task started.\r\n";

void vPrintDisplayMessage( const char * const * ppcMessageToSend );

static void vLEDFlashTask( void *pvParameters )
{
    /* Queue a message for printing to say the task has started. */
    vPrintDisplayMessage( &pcTaskStartMsg ); // <--- FAILED HERE
}

gives:

test.c:8: error 78: incompatible types
from type 'const-unsigned-char generic* const code* code'
  to type 'const-unsigned-char generic* const unknown* fixed'
test.c:8: warning 85: in function vLEDFlashTask unreferenced function argument : 'pvParameters'

Related

Bugs: #2766
Discussion: Building FreeRTOS with SDCC
Discussion: fbea223c
Discussion: Cygnal freeRTOS (v9.0.0) Demo build failed with sdcc 3.5.0
Patches: #392
Wiki: SDCC-STD-UX

Discussion

  • Philipp Klaus Krause

    Bug [#2556] seems similar.

    Philipp

     

    Related

    Bugs: #2556


    Last edit: Maarten Brock 2017-07-15
  • Nikolay

    Nikolay - 2019-03-20

    It seems the problem still exists with SDCC 11119...

    Compiling the next code:

    const char *const data[] = {"a", "b", "c"};
    
    void testptrs(const char *const *ptr);
    
    void testptrs1()
    {
       testptrs(data);
    }
    
    void testptrs(const char *const *ptr)
    {
    }
    

    causes error:

    .\Source\testptr.c:7: error 78: incompatible types
    from type 'const-unsigned-char generic* const [3] code'
      to type 'const-unsigned-char generic* const unknown* fixed'
    

    The same code without testptrs function prototype can be compiled without errors:

    const char *const data[] = {"a", "b", "c"};
    
    void testptrs(const char *const *ptr)
    {
    }
    
    void testptrs1()
    {
       testptrs(data);
    }
    

    Command line:
    sdcc -c -mstm8 --opt-code-speed --max-allocs-per-node 100000 --std-c11 testptr.c

    Btw as I remember I could compile the same code with some previous SDCC version (probably it was a version prior to 10803)...

     
  • Philipp Klaus Krause

    Apparently, this fails to compile, even when the address space issue is not there:

    const char *const data[] = {"a", "b", "c"};
    
    char testptrs(const char *const *__code ptr);
    
    void testptrs1()
    {
       testptrs(data);
    }
    
    test.c:7: error 78: incompatible types
    from type 'const-unsigned-char generic* const [3] code'
      to type 'const-unsigned-char generic* const unknown* code'
    
     

    Last edit: Philipp Klaus Krause 2022-04-15
    • Philipp Klaus Krause

      Sorry, I was wrong here, put the __code int he wrong place. The following compiles:

      const char *const data[] = {"a", "b", "c"};
      
      char testptrs(const char *const __code* ptr);
      
      void testptrs1()
      {
         testptrs(data);
      }
      

      So the error message is about the implicit named address space.

       
  • Philipp Klaus Krause

    Looking into this a bit deeper, I think the underlying issue is an UPOINTER surviving past the parsing stage. That indicates that somewhere, a call to pointerTypes is missing that should have turned it into a GPOINTER here.
    In [r13387], I added an assertion to catch this. The bug isn't fixed yet, but the error message is better now.

    P.S.: No, pointerTypes gets called on the parameter type. But it apparently has a bug when there are multiple UPOINTER chained, so only one gets fixed.

     

    Related

    Commit: [r13387]


    Last edit: Philipp Klaus Krause 2022-04-15
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Fixed in [r13388]

     

    Related

    Commit: [r13388]


Log in to post a comment.

MongoDB Logo MongoDB