tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Misleading warning message - both gcc and clang refuse to


From: Eric Raible
Subject: [Tinycc-devel] Misleading warning message - both gcc and clang refuse to compile and error out
Date: Sat, 25 Nov 2023 23:21:43 -0800

The following program has an obvious bug, and both gcc and clang refuse
to compile it with an on-point error.  tcc produces an incorrect warning and
creates code that has no chance of working:

#include <stdio.h>

typedef struct symbol symbol;
extern void foo(symbol *);

int main()
{
  foo(&(symbol){});
  return 0;
}

struct symbol {
  char *name;
  int size;
};

void foo(symbol *s)
{
  printf("name=[%s]", s->name);
}

tcc version 0.9.28rc 2023-11-08 mob@be8f894 (x86_64 Linux) 

This is obviously not a show-stopper, but using an incomplete type _is_ something
that can happen in real life, and tcc does a pretty poor job here.  I'd be willing to take
a look if someone can give me some hints.

Thanks - Eric

reply via email to

[Prev in Thread] Current Thread [Next in Thread]