请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430FR2633 各位专家、您好!
当我编写下面的链接时、编译器错误会发生什么类型的 C 代码?
https://sir.ext.ti.com/jira/browse/EXT_EP-8048
此致、
Sasaki
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
各位专家、您好!
当我编写下面的链接时、编译器错误会发生什么类型的 C 代码?
https://sir.ext.ti.com/jira/browse/EXT_EP-8048
此致、
Sasaki
/*
cl430 -vmspx --code_model=large --data_model=large --near_data=globals --opt_level=off test.c -k --symdebug:none -z -llnkx.cmd
*/
#include <stdio.h>
void func(void) { }
void call1(void) { }
int something;
void fn1()
{
if ((unsigned)(unsigned long)func & 1) call1();
}
void fn2()
{
if ((unsigned)(unsigned long)&something & 1) call1();
}
int main()
{
fn1();
fn2();
return 0;
}
当此代码的构建如注释中开头附近所示时,会发生...
% cl430 -vmspx --code_model=large --data_model=large --near_data=globals --opt_level=off test.c -k --symdebug:none -z -llnkx.cmd "test.c", line 16: warning: integer conversion resulted in truncation "test.c", line 21: warning: integer conversion resulted in truncation <Linking> warning: relocation to symbol "func" overflowed; the 17-bit relocated address 0x100f6 is too large to encode in the 16-bit field (type = 'R_MSP430X_ABS16' (15), file = "test.obj", offset = 0x00000004, section = ".text:fn1") warning: output file "a.out" cannot be loaded and run on a target system
谢谢、此致、
乔治