Am Sonntag, den 31.08.2014, 13:51 +0400 schrieb Alexander Monakov: > On Sun, 31 Aug 2014, Jens Gustedt wrote: > > > > @@ -234,7 +253,10 @@ static int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restr > > > > new->canary = self->canary; > > > > > > > > a_inc(&libc.threads_minus_1); > > > > - ret = __clone(start, stack, flags, new, &new->tid, TP_ADJ(new), &new->tid); > > > > + if (c11) > > > > + ret = __clone(start_c11, stack, flags, new, &new->tid, TP_ADJ(new), &new->tid); > > > > + else > > > > + ret = __clone(start, stack, flags, new, &new->tid, TP_ADJ(new), &new->tid); > > > > > > Couldn't this be "c11 ? start_c11 : start" to avoid duplicating the > > > rest of the call? > > > > I think that the ternary expression together with the other > > parenthesized paramenter and the length of the line would make the > > line barely readable. > > > > This are some of the pivots lines of the implementation, I'd rather > > have them stick out. > > > > Also the assembler that is produced should be identical. > > It probably won't be with GCC. Try: > > echo 'int g(int); int f(int y){if (y) return g(0); else return g(1);}' | > gcc -xc - -S -o- -O > > And try varying optimization levels. With gcc-4.8 on x86-64 I get two calls > except with -Os, and even with -Os it's worse than with a ternary operator. Interesting remark, but your example is a bit flawed. It has the types of the arguments for f and g the same, int. This has gcc attempt to save things in the entry register for the first argument of the call. As expected with the following, more complete example I see no difference for the assembler for f or h, but for the names of the labels. This holds for gcc and clang. echo 'int g(void*); int a; int b; int f(int y){ if (y) return g(&a); else return g(&b);} int h(int y) { return y ? g(&a) : g(&b); }' | gcc -xc - -S -o- -O Jens -- :: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS ::: :: ::::::::::::::: office Strasbourg : +33 368854536 :: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::