02 December 2022, 19:47 | #1 |
Registered User
Join Date: Jan 2018
Location: Germany
Posts: 46
|
VC +aosppc does not like getchar()
Hi,
I stumbled over a VBCC issue while working through the C-Book that is bundled with Cubic IDE. It is the example 4.8 that causes strange errors when compiling with vc +aosppc only. vc +aos68k or gcc works. This is the smallest example I could come up with: Code:
#include <stdio.h> #include <stdlib.h> int main() { for (;;) { if (getchar() != '\n') { printf("error\n"); } else break; } exit(EXIT_SUCCESS); } Code:
vc +aosppc test.c -o test warning 2004 in line 42 of "T:t_10_0.asm": trailing garbage in operand > bl _fillbuf t_10_0.o: In function "main": Error 21: t_10_0.o (.text+0x78): Reference to undefined symbol _ 1. vlink fehlgeschlagen, Rückgabewert 20 vlink -belf32amigaos -q -n -Cvbccelf -P_start -P__amigaos4__ -nostdlib -fixunnamed -interp "vbcc 0.9" -Tvlibos4:script vlibos4:startup.o "T:t_10_0.o" -s -x -Lvlibos4: -LSObjs: -lvc -o test failed Code:
vc +newlib test.c -o test AmigaOS 4.1 FE Update 2 + Enhancer 2.2 and all updates SDK 54.16 vbcc 0.9h config: Code:
type vbcc:config/aosppc -elf -no-regnames -no-multiple-ccs -madd -use-commons -cc=vbccppc -quiet %s -o= %s %s -O=%ld -Ivincludeos4: -D__amigaos4__ -ccv=vbccppc %s -o= %s %s -O=%ld -Ivincludeos4: -D__amigaos4__ -as=vasmppc_std -quiet -Felf -opt-branch -no-regnames -nowarn=62 %s -o %s -asv=vasmppc_std -Felf -opt-branch -no-regnames -nowarn=62 %s -o %s -isc=vscppc -quiet %s %s -iscv=vscppc %s %s -rm=delete quiet %s -rmv=delete %s -ld=vlink -belf32amigaos -q -n -Cvbccelf -P_start -P__amigaos4__ -nostdlib -fixunnamed -interp "vbcc 0.9" -Tvlibos4:script vlibos4:startup.o %s %s -Lvlibos4: -LSObjs: -lvc -o %s -l2=vlink -belf32amigaos -q -n -Cvbccelf -P_start -P__amigaos4__ -nostdlib -fixunnamed -interp "vbcc 0.9" -Tvlibos4:script %s %s -Lvlibos4: -LSObjs: -o %s -ldv=vlink -belf32amigaos -t -q -n -Cvbccelf -P_start -P__amigaos4__ -nostdlib -fixunnamed -interp "vbcc 0.9" -Tvlibos4:script vlibos4:startup.o %s %s -Lvlibos4: -LSObjs: -lvc -o %s -l2v=vlink -belf32amigaos -t -q -n -Cvbccelf -P_start -P__amigaos4__ -nostdlib -fixunnamed -interp "vbcc 0.9" -Tvlibos4:script %s %s -Lvlibos4: -LSObjs: -o %s -ldnodb=-s -x -ldstatic=-Bstatic -ul=-l%s -cf=-F%s -ml=500 |
12 December 2022, 10:43 | #2 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
I couldn't reproduce it. But this looks very suspicious:
Quote:
Did you compile with the OS4-native vbccppc? Can you try other binaries (for example OS2/3-native) for comparison? Feel free to contact me by mail and send me your binaries and example code. |
|
12 December 2022, 19:44 | #3 |
Registered User
Join Date: Jan 2018
Location: Germany
Posts: 46
|
Thanks for looking into this.
No, no changes with the latest OS4 bin und target packages from http://sun.hasenbraten.de/vbcc/. Yes, I am using the native OS4 version of vc/vbccpcc. Yes, I tried also the classic Amiga version of vc, same result. And I tried different SDKs (53.34, 54.16), and reinstalled 54.16 just to be sure that I did not have a broken file somewhere. Still the same error. So, it is an issue with the header file or macro. If I do not include "stdio.h", it works. I will see if I can collect a small test case for you. |
12 December 2022, 21:59 | #4 |
Registered User
Join Date: Jan 2018
Location: Germany
Posts: 46
|
Okay, this is strange. I cannot reproduce the issues on my Classic AmigaOS 4.1 FE Update 2 running in WinUAE.
I need to check what the differences between the installation in WinUAE and the one on my X5000 is. |
13 December 2022, 12:44 | #5 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Yes, it's definitely the macro from stdio.h, which includes _fillbuf.
The SDK is completely irrelevant in your simple example. Just checked it on my Pegasos2 with OS4 Kickstart 53.5 and WB 53.1, but couldn't reproduce it either. Please keep me informed. |
13 December 2022, 17:43 | #6 |
Registered User
Join Date: Apr 2013
Location: Mallorca
Posts: 758
|
With the latest vasmppc-std-mos (1.9a) the same bugs arise when compiling for warpos. It is not related to a particular function or macro: The garbage and the undefined symbol could be anything in multiple sources within a project.
(Note before confusion: Yep I use mos binaries to compile wos vbcc stuff.) With no changes in any configuration or SDK, going back to old vasm version all works. For me: 68k vasm 1.9a is Ok. ppc vasm 1.9 is Ok. vasmppc 1.9a has a similar bug that happend many moons ago in older vbcc sdk. And I cried about that. Last edited by Cowcat; 13 December 2022 at 17:52. |
13 December 2022, 18:45 | #7 |
Registered User
Join Date: Jan 2018
Location: Germany
Posts: 46
|
Yes, I am also use vasmppc-std 1.9a on my X5000. On my classic AOS 4.1 I have vasmppc-std 1.9.
Sadly, in my tests always the broken vasmppc-std was picked (thank you APPDIR: ). |
14 December 2022, 12:44 | #8 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Thanks guys! I can reproduce it! It is indeed caused by vasmppc_std V1.9a. Then not even the host OS makes a difference (got it under OS4, MorphOS, NetBSD). The last vbcc release was bundled with V1.9, which was the reason I didn't see the problem.
Will fix it immediately. EDIT: Done. Please try tomorrow's V1.9b beta source snapshot. The problem was caused by the introduction of one-digit temporary labels in the std-syntax module of V1.9a. Due to a bug also _b and _f refered to the previous or next temporary label, which should be restricted to digits only, like 0b, 1f, etc. Thanks for reporting! Last edited by phx; 14 December 2022 at 17:31. Reason: Fixed |
15 December 2022, 16:43 | #9 |
Registered User
Join Date: Jan 2018
Location: Germany
Posts: 46
|
Hi phx,
Thank you. I just compiled vasmppc_std using todays source snapshot. My tests and the example from the "C Book" work fine with vasm 1.9b. |
15 December 2022, 22:22 | #10 |
Registered User
Join Date: Apr 2013
Location: Mallorca
Posts: 758
|
Today binary compile (last snapshot 15 dec 2022) seems to work quite well.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|