Page 1 of 1

compilation error at debug.print

Posted: 09 May 2013, 0:28 AM
by wwwoholic
The following line produces an error in 4.1.7:
Debug.Print CStr(CInt(VRL)); " "; CStr(CInt(VRR))

There is no error if I remove " "; from the output or replace it with something else, like "-";

Code: Select all

avr-gcc -o scooter.i1 -mmcu=atmega1280 -Wl,--gc-sections,--relax   -Wl,-T,"C:/PROGRA~2/ZBasic/zlib/avr/ldscripts/zbasic_avr51.lds"  -Wl,--defsym,zbSendByte=zbSendByteHW -Wl,--defsym,zbBaudDivisor=zbBaudDivSimple -Wl,--defsym,zbUartData=zbUartData4 --param inline-call-cost=2 "C:/PROGRA~2/ZBasic/zlib/avr/arch/zbasic_avr51.o" "C:/PROGRA~2/ZBasic/zlib/avr/ST/libST_mega1280.a"  scooter.o config.o util.o comlib.o motorlib.o servolib.o RoboteqMDC2250C.o devices.o cinput.o curves.o geometry.o motors.o   "C:/PROGRA~2/ZBasic/zlib/avr/lib/libmega1280.a" "C:/PROGRA~2/ZBasic/zlib/avr/ST/libST_mega1280.a" -lm
c:/progra~2/zbasic/winavr/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr51/crtm1280.o: In function `__vector_default':
(.vectors+0xdc): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_55' defined in .text section in C:/PROGRA~2/ZBasic/zlib/avr/lib/libmega1280.a(com8_ISR_avr.o)
make: *** [scooter.i1] Error 1

Posted: 09 May 2013, 8:42 AM
by dkinzer
Using the clues present in the information you posted, I tried to determine the cause of the problem - to no avail, unfortunately. A "relocation truncation error" problem like this (link-time computation of a limited-range relative branch) depends on the size and organization of the application. As you've noted, making a small change can be enough to allow a successful computation. Here again, having access to all of the application source code will facilitate tracking down the issue.

Posted: 16 May 2013, 21:53 PM
by wwwoholic
I wonder how that string literal stored though, because changing the character does not change the length of a string, so technically there should be absolutely no difference form the compiler's point of view... unless string constants are shared and I have another " " somewhere in the program.

Posted: 17 May 2013, 7:35 AM
by dkinzer
wwwoholic wrote: unless string constants are shared and I have another " " somewhere in the program.
The compiler does implement a constant string pool allowing multiple uses of identical strings to be shared.