Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bad optimisations: (Was: Test version zsh-3.1.6-test-1)



Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> wrote in zsh-users:
:Under DU 4.0 with gcc-2.8.1 I get a SEGV in a piece of completely
:correct C-code in bin_read(). I can work around this by using the
:patch below -- which, of course, is completely silly.
:Dunno if this should be included, but the SEGV is deadly: it fails on
:e.g. the read in compinit.

-    if (*args && **args == '?')
-	args++;
-    /* default result parameter */
-    reply = *args ? *args++ : ops['A'] ? "reply" : "REPLY";
+    if (*args && **args == '?') {
+    	args++;
+	/* default result parameter */
+	reply = *args ? *args++ : ops['A'] ? "reply" : "REPLY";
+	/* (If we put this reply=... after the `if' gcc-2.8.1 under
+	   Digital Unix 4.0 generates incorrect code.) */
+    } else
+	reply = *args ? *args++ : ops['A'] ? "reply" : "REPLY";
+

What about just expanding it slightly (with appropriate comments of course)
instead of duplicating it.
e.g.

    if (*args && **args == '?')
        args++;
    /* default result parameter */
    if (*args)
        reply = *args++;
    else
        reply = ops['A'] ? "reply" : "REPLY";

Regards,
-- 
Geoff Wing : <gcw@xxxxxxxxx>     Work URL: http://www.primenet.com.au/
Rxvt Stuff : <gcw@xxxxxxxx>      Ego URL : http://pobox.com/~gcw/
Zsh Stuff  : <gcw@xxxxxxx>       Phone   : (Australia) 0413 431 874



Messages sorted by: Reverse Date, Date, Thread, Author