文件
Paze AI 251ee470bf feat: Paze C Compiler - 完整改造自 tcc 0.9.28rc
- 所有 tcc 文件/内容/宏改名为 pcc (tcc.c->pcc.c, tccelf.c->pccelf.c, libtcc.c->libpcc.c 等)
- 支持架构: i386, x86_64, ARM, ARM64, RISC-V, C67
- 支持格式: PE, ELF, Mach-O, COFF
- 完整预处理、代码生成、链接器、调试信息
- 构建成功: pcc.exe (x86_64 Windows)
- 功能测试通过: 递归/结构体/浮点/switch/循环
- 自编译测试通过: pcc 可以编译自身
2026-08-16 13:30:01 +08:00

63 行
1.4 KiB
C

static int simple_jump(void)
{
asm goto ("jmp %l[label]" : : : : label);
return 0;
label:
return 1;
}
static int three_way_jump(int val, int *addr)
{
*addr = 42;
asm goto ("cmp $0, %1\n\t"
"jg %l[larger]\n\t"
"jl %l[smaller]\n\t"
"incl %0\n\t"
: "=m" (*addr)
: "r" (val)
:
: smaller, larger);
return 1;
smaller:
return 2;
larger:
return 3;
}
static int another_jump(void)
{
asm goto ("jmp %l[label]" : : : : label);
return 70;
/* Use the same label name as in simple_jump to check that
that doesn't confuse our C/ASM symbol tables */
label:
return 71;
}
extern int printf (const char *, ...);
int main(void)
{
int i;
if (simple_jump () == 1)
printf ("simple_jump: okay\n");
else
printf ("simple_jump: wrong\n");
if (another_jump () == 71)
printf ("another_jump: okay\n");
else
printf ("another_jump: wrong\n");
if (three_way_jump(0, &i) == 1 && i == 43)
printf ("three_way_jump(0): okay\n");
else
printf ("three_way_jump(0): wrong (i=%d)\n", i);
if (three_way_jump(1, &i) == 3 && i == 42)
printf ("three_way_jump(1): okay\n");
else
printf ("three_way_jump(1): wrong (i=%d)\n", i);
if (three_way_jump(-1, &i) == 2 && i == 42)
printf ("three_way_jump(-1): okay\n");
else
printf ("three_way_jump(-1): wrong (i=%d)\n", i);
return 0;
}