[antlr-interest] Bug in 64bit C backend

Jim Idle jimi at temporal-wave.com
Wed Jul 30 19:50:44 PDT 2008


On Wed, 2008-07-30 at 17:59 -0400, Jason Nielsen wrote:

> Hello,
> 
> I believe there is a bug in the 64 bit version of the C backend runtime since 
> using the 32bit version works as expected (or it could be that I've done 
> something foolish that works in 32 bit mode and not in 64 bit). I've attached a 
> tar.gz with code that illustrates the problem and was as simple as I could make 
> it.  The output is also below for your convenience.
> 

IN fact my development version did have a bug because I was in the
middle of fixing something else. I just completed that fix and now i
get:

./a.out
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))
Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
(ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
(BLOCK (= x 3) (= y 5)))))


Once I fixed your translate() function and using the b3 runtime tar.

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080730/f0c77290/attachment.html 


More information about the antlr-interest mailing list