https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63645

M Welinder <terra at gnome dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33809|0                           |1
        is obsolete|                            |

--- Comment #11 from M Welinder <terra at gnome dot org> ---
Created attachment 33814
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33814&action=edit
Updated test program

I agree that C99 says that a struct around the oper member is required.
That is Section 6.5.2.3 #5.  It is inconvenient and probably not what
the committee intended, but it is all we have.  So be it.  For the test
program I simply grab oper out of the binary member.

I haven't yet figured out how to remove valgrind from the setup.  Here's
what it says:

==20506== Invalid read of size 8
==20506==    at 0x4005E8: test (vvv.c:35)
==20506==    by 0x4004D8: main (vvv.c:46)
==20506==  Address 0x51fd040 is 0 bytes inside a block of size 1 alloc'd
==20506==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20506==    by 0x4005DA: test (vvv.c:53)
==20506==    by 0x4004D8: main (vvv.c:46)

Note: GnmExprBinary is back to a single member.  C99's Section 6.5 #7
says that such an object can be accessed through a union that contain
the type:

       [#7] An object shall have its stored value accessed only  by
       an lvalue expression that has one of the following types:63)
[...]
         -- an aggregate or union type that  includes  one  of  the
            aforementioned  types  among  its  members  (including,
            recursively, a member of a  subaggregate  or  contained
            union), or

Whatever created the error message of comment 4 therefore seems to be
wrong.  Unless something else disallows this.

- * -

I looked that the generated assembler code and here is the relevant
part that shows that both the oper and func.argc fields are being
tested in one go.  The object doesn't have the func.argc field.

.LBE4:
    .loc 1 35 0
    movabsq    $-4294967041, %rdx
.LBB7:
.LBB6:
    .loc 1 54 0
    movb    $0, (%rax)
.LBE6:
.LBE7:
    .loc 1 35 0
    andq    (%rax), %rdx
    movabsq    $4294967297, %rcx
    cmpq    %rcx, %rdx
    je    .L5

Reply via email to