endrazine / wcc

The Witchcraft Compiler Collection
Other
1.83k stars 110 forks source link

conditional return in void function causes wcc to expect the function to end #42

Open Salakksson opened 8 months ago

Salakksson commented 8 months ago

in the following void function, i attempt to return early if the string is empty. this caused the compiler to expect the function to end and throw a missing '}' error:

37 void _cdecl printf_tt(char* str, ...)
 38 {
 39     if (!str[0])
 40         return;
 41 
 42     void* argv = &str + sizeof(str);        // Use stack manipulation to find arg array
 43     // function continues here...

stdio.c(42): Error! E1077: Missing '}' stdio.c(42): Error! E1011: Symbol 'str' has not been declared`

Salakksson commented 8 months ago

gcc compiles the same function without problems

endrazine commented 2 months ago

Hi, thanks for reaching out. What compiler did you first use to generate the issue ?

Salakksson commented 1 month ago

to compile i used /usr/bin/watcom/binl/wcc -4 -d3 -s -wx -ms -zl -zq i believe, i copied the makefile from a tutorial

Salakksson commented 1 month ago

i installed wcc on either debian using apt or arch using pacman and was compiling a 16bit binary