This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SIMPLE NOT expressions


On Thu, 18 Jul 2002, Steven Bosscher wrote:

> My mistake. Before I wrote this code, I looked at tree-simple.c:
> 
>       unop
>               : '+'
>               | '-'
>               | '!'
>               | '~'
> 
> But these are bitwise unops, so we're actually generating non-SIMPLE
> code. Oops!
> 
But wait, the grammar is inconsistent here.  On the one hand we
say that we should accept '!a' and on the other hand we are
converting '!a' into 'a != 0'.  We had not had this problem before
because the C front end always generates 'a != 0' for '!a'.

For the sake of consistency I vote for removing the unary
operator ! from the grammar.  After all, we define condexpr to be
'val op val'.

Thoughts?

Diego.



	* tree-simple.c: Don't allow '!' as a unary operator.

Index: tree-simple.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-simple.c,v
retrieving revision 1.1.4.3
diff -d -u -p -r1.1.4.3 tree-simple.c
--- tree-simple.c       4 Jul 2002 20:32:18 -0000       1.1.4.3
+++ tree-simple.c       19 Jul 2002 01:27:37 -0000
@@ -134,7 +134,6 @@ Boston, MA 02111-1307, USA.  */
       unop
              : '+'
              | '-'
-             | '!'
              | '~'

       binop


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]