Re: [9fans] copy paste bug in cc.y?

2014-10-21 Thread Yoann Padioleau
but (0:int + x) would not do the same thing? What is special about using SUB instead of ADD? On Oct 17, 2014, at 12:07 PM, Charles Forsyth charles.fors...@gmail.commailto:charles.fors...@gmail.com wrote: On 17 October 2014 18:48, Yoann Padioleau p...@fb.commailto:p...@fb.com wrote:

Re: [9fans] copy paste bug in cc.y?

2014-10-21 Thread Charles Forsyth
On 21 October 2014 18:34, Yoann Padioleau p...@fb.com wrote: but (0:int + x) would not do the same thing? What is special about using SUB instead of ADD? you can't subtract pointers from 0 but you can add 0 to a pointer, since + is commutative

Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Yoann Padioleau
Somehow? Would be nice to have a comment explaining this “somehow then because it looks tricky. Also is there a place explaining the naming conventions? I have a hard time understanding what is the difference between tcom(), acom(), xcom(), and then there’s complex() … On Oct 14, 2014, at

Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Yoann Padioleau
0:int - x was not enough for those balancing(?) and promoting thing? On Oct 17, 2014, at 12:07 PM, Charles Forsyth charles.fors...@gmail.commailto:charles.fors...@gmail.com wrote: it's building a tree for (0:int-(0:int-x)) which later transformations will simplify to x, but having done the

Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread minux
On Fri, Oct 17, 2014 at 4:00 PM, Yoann Padioleau p...@fb.com wrote: 0:int - x was not enough for those balancing(?) and promoting thing? It's enough for type promotion, but you changed the semantics of the program.

Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Yoann Padioleau
:) Got it :) On Oct 17, 2014, at 1:04 PM, minux minux...@gmail.commailto:minux...@gmail.com wrote: On Fri, Oct 17, 2014 at 4:00 PM, Yoann Padioleau p...@fb.commailto:p...@fb.com wrote: 0:int - x was not enough for those balancing(?) and promoting thing? It's enough for type promotion, but

Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Charles Forsyth
On 17 October 2014 18:48, Yoann Padioleau p...@fb.com wrote: Also is there a place explaining the naming conventions? I have a hard time understanding what is the difference between tcom(), acom(), xcom(), and then there’s complex() … the compiler assumes you've know your Aho and Ullmann

Re: [9fans] copy paste bug in cc.y?

2014-10-14 Thread Rob Pike
Looks like it. -rob On Tue, Oct 14, 2014 at 3:11 PM, Yoann Padioleau p...@fb.com wrote: Hi, It’s a copy paste bug here right? https://code.google.com/p/ken-cc/source/browse/src/cmd/cc/cc.y#476 | LSWITCH '(' cexpr ')' stmnt { $$ = new(OCONST, Z,

Re: [9fans] copy paste bug in cc.y?

2014-10-14 Thread Rob Pike
It's not dead code. It's prepping the switch somehow. -rob On Tue, Oct 14, 2014 at 3:45 PM, Rob Pike robp...@gmail.com wrote: Looks like it. -rob On Tue, Oct 14, 2014 at 3:11 PM, Yoann Padioleau p...@fb.com wrote: Hi, It’s a copy paste bug here right?