g++, objective C は使っていないのでわかりません(汗;)。
% cat Makefile
CC = gcc -Wall
CFLAGS =
GCC2_OPTION0 =
GCC2_OPTION1 =
GCC2_OPTION2 =
G2AS = *
pcr3.o: pcr3.c
$(CC) -O -c $<
%
%
% cat pcr3.c
/* L3E19 で復活 */
static __pcr__ int foo;
void baz(void);
void
bar()
{
if (!foo)
return;
baz();
}
%
%
% make
gcc -Wall -O -c pcr3.c
処理関数
insn 処理開始後発生
コンパイルを中断します exec addr=2
gcc: g2cc1 が終了コード 1 で処理を停止しました
make: *** [pcr3.o] Error 1
目次に戻る
戻る
% cat Makefile
CC = gcc -Wall
CFLAGS =
GCC2_OPTION0 =
GCC2_OPTION1 =
GCC2_OPTION2 =
G2AS = *
pcr15.o: pcr15.c
$(CC) -c $<
random.o: random.c
$(CC) -m68020 -c $<
%
%
% cat pcr15.c
/* L3E19: コンパイル中断 */
extern long randtbl[];
static long *state = &randtbl[1];
static __pcr__ int rand_type = 3;
void
srandom(unsigned int x)
{
if (rand_type == 0)
state[0] = x;
}
%
%
% make
gcc -Wall -c pcr15.c
処理関数
insn 処理開始後発生
コンパイルを中断します exec addr=1
gcc: g2cc1 が終了コード 1 で処理を停止しました
make: *** [pcr15.o] Error 1
目次に戻る
戻る
% cat Makefile
CC = gcc -Wall
CFLAGS =
GCC2_OPTION0 =
GCC2_OPTION1 =
GCC2_OPTION2 =
G2AS = *
insn4.o: insn4.c
$(CC) -S $<
as $*.s
%
%
% cat insn4.c
/* L3E19: insn error */
typedef struct BUFFER {
char b_bname[32];
} BUFFER;
typedef struct NBIND {
char *n_name;
} NBIND;
static __pcr__ void *sptr = ((void *)0);
static __pcr__ char *nametop = ((void *)0);
static __pcr__ int type = 0;
void
getbody(void)
{
switch (type) {
case 0:
nametop = ((BUFFER *) sptr)->b_bname;
break;
case 2:
nametop = ((NBIND *) sptr)->n_name;
break;
case 3:
case 10:
nametop = sptr;
break;
case 8:
nametop = *((char **)sptr);
break;
}
}
%
%
% make
gcc -Wall -S insn4.c
処理関数
insn 処理開始後発生
バスエラーが発生しました
st=13 pc=41A1D6 offset=ABB96 abort stack=4927EE stack top=473F40
(note 2 0 3 "" NOTE_INSN_DELETED)
(note 3 2 4 "" NOTE_INSN_FUNCTION_BEG)
(note 4 3 6 "" NOTE_INSN_DELETED)
(note 6 4 67 "" NOTE_INSN_DELETED)
(insn 67 6 70 (set (reg:SI 9 a1)
(symbol_ref:SI ("type"))) -1 (nil)
(nil))
(insn 70 67 44 (set (reg:SI 2 d2)
(const_int 10)) -1 (nil)
(nil))
(insn:HI 44 70 45 (set (cc0)
(compare (mem:SI (symbol_ref:SI ("type")))
(const_int 10))) 9 {cmpsi} (nil)
(nil))
(jump_insn 45 44 47 (set (pc)
(if_then_else (gtu (cc0)
(const_int 0))
(label_ref 59)
(pc))) 239 {bgtu} (nil)
(nil))
(insn 47 45 49 (set (reg:SI 0 d0)
(mem:SI (symbol_ref:SI ("type")))) 29 {movhi-2} (nil)
(nil))
(insn 49 47 50 (set (reg:SI 1 d1)
(reg:SI 0 d0)) 29 {movhi-2} (nil)
(nil))
(insn:HI 50 49 52 (set (reg:SI 0 d0)
(ashift:SI (reg:SI 1 d1)
(const_int 1))) 177 {ashlsi3-1} (nil)
(expr_list:REG_EQUAL (mult:SI (reg:SI 0 d0)
(const_int 2))
(nil)))
(insn 52 50 53 (set (reg:SI 8 a0)
(label_ref:SI 56)) 29 {movhi-2} (nil)
(nil))
(insn 53 52 55 (set (reg:HI 0 d0)
(mem/u:HI (plus:SI (reg:SI 0 d0)
(reg:SI 8 a0)))) 31 {movhi} (nil)
(nil))
(jump_insn 55 53 56 (parallel[
(set (pc)
(plus:SI (pc)
(reg:HI 0 d0)))
(use (label_ref 56))
] ) 259 {tablejump+2} (nil)
(nil))
(code_label 56 55 57 8 "")
(jump_insn 57 56 58 (addr_diff_vec:HI (label_ref:SI 56)
[
(label_ref:SI 9)
(label_ref:SI 59)
(label_ref:SI 16)
(label_ref:SI 26)
(label_ref:SI 59)
(label_ref:SI 59)
(label_ref:SI 59)
(label_ref:SI 59)
(label_ref:SI 33)
(label_ref:SI 59)
(label_ref:SI 26)
] ) -1 (nil)
(nil))
(barrier 58 57 8)
(note 8 58 9 "" NOTE_INSN_DELETED)
(code_label 9 8 12 3 "")
(insn:HI 12 9 14 (set (mem:SI (symbol_ref:SI ("nametop")))
(mem:SI (symbol_ref:SI ("sptr")))) 29 {movhi-2} (nil)
(nil))
(jump_insn 14 12 15 (set (pc)
(label_ref 59)) 256 {jump} (nil)
(nil))
(barrier 15 14 16)
(code_label 16 15 19 4 "")
(insn 19 16 21 (set (reg:SI 8 a0)
(mem:SI (symbol_ref:SI ("sptr")))) 29 {movhi-2} (nil)
(nil))
(insn:HI 21 19 23 (set (mem:SI (symbol_ref:SI ("nametop")))
(mem/s:SI (reg:SI 8 a0))) 29 {movhi-2} (nil)
(nil))
(jump_insn 23 21 24 (set (pc)
(label_ref 59)) 256 {jump} (nil)
(nil))
(barrier 24 23 25)
(code_label 25 24 26 5 "")
(code_label 26 25 29 6 "")
(insn:HI 29 26 31 (set (mem:SI (symbol_ref:SI ("nametop")))
(mem:SI (symbol_ref:SI ("sptr")))) 29 {movhi-2} (nil)
(nil))
(jump_insn 31 29 32 (set (pc)
(label_ref 59)) 256 {jump} (nil)
(nil))
(barrier 32 31 33)
(code_label 33 32 36 7 "")
(insn 36 33 38 (set (reg:SI 8 a0)
(mem:SI (symbol_ref:SI ("sptr")))) 29 {movhi-2} (nil)
(nil))
(insn:HI 38 36 40 (set (mem:SI (symbol_ref:SI ("nametop")))
(mem:SI (reg:SI 8 a0))) 29 {movhi-2} (nil)
(nil))
(jump_insn 40 38 41 (set (pc)
(label_ref 59)) 256 {jump} (nil)
(nil))
(barrier 41 40 43)
(code_label 43 41 59 9 "")
(code_label 59 43 61 2 "")
(note 61 59 63 "" NOTE_INSN_FUNCTION_END)
(code_label 63 61 64 1 "")
(note 64 63 0 "" NOTE_INSN_DELETED)
gcc: g2cc1 が終了コード 512 で処理を停止しました
make: *** [insn4.o] Error 1
目次に戻る
戻る
1 /* 1.29 Tool#2: -O -fforce-addr -m68040 */
2 char foo = 0;
3
4 bar(char *poi[])
5 {
6 short j;
7
8 for (; poi[0][j]; j++) {
9 if (poi[0][j] == 'f')
10 foo = 1;
11 }
12 }
このソースを -O -fforce-addr -m68040 でコンパイルすると次のようなソースを
吐いてくれます。
1 * NO_APP
2 RUNS_HUMAN_VERSION equ 3
3 .cpu 68040
4 .include doscall.equ
5 * X68 GCC Develop
6 .globl _foo
7 .even
8 .data
9 _foo:
10 .dc.b 0
11 .even
12 .text
13 .even
14 .globl _bar
15 _bar:
16 link a6,#0
17 move.l (8,a6),a0
18 lea _foo,a1
19 jbra ?2
20 ?6:
21 cmp.b #102,([a0],d0.w)([a0],d0.l*0)
22 jbne ?4
23 move.b #1,(a1)
24 ?4:
25 addq.w #1,d0
26 ?2:
27 tst.b ([a0],d0.w)([a0],d0.l*0)
28 jbne ?6
29 unlk a6
30 rts
31 .even
32 .end
21,27行目が変ですね。C ソースの 6行目を short から int にすれば直
ります。