]> git.sur5r.net Git - cc65/commitdiff
Fixed a pointer-difference, comparison-with-zero expression. 391/head
authorGreg King <gregdk@users.sf.net>
Wed, 1 Mar 2017 11:36:25 +0000 (06:36 -0500)
committerGreg King <gregdk@users.sf.net>
Wed, 1 Mar 2017 11:52:43 +0000 (06:52 -0500)
Some GCC C compilers can't subtract higher pointers from lower pointers properly, when those pointers must be scaled (because they point to objects that are wider than a char). The scaling is done as unsigned which makes the difference positive instead of negative.

So, a broken expression was changed into a direct comparison between the two pointers.

test/ref/yacc.c

index 5768f80d00b5fb5708c8db6aa58018ecb0e68882..d0b9190e4f54213c980018ae45c16e09494a65a7 100644 (file)
@@ -562,7 +562,7 @@ yylook()
                }
 
 # ifdef LEXDEBUG
-               if((*(lsp-1)-yysvec-1)<0)
+               if (*(lsp-1) < yysvec + 1)
                {
                        fprintf(yyout,"yylook:  stopped (end)\n");
                }