public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions
       [not found] <bug-63862-4@http.gcc.gnu.org/bugzilla/>
@ 2014-11-14 17:25 ` joseph at codesourcery dot com
  2014-11-14 17:28 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: joseph at codesourcery dot com @ 2014-11-14 17:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
If the middle-end handles arbitrary integer types for shift counts, it 
should be fine to remove this conversion (but check that the ubsan code 
will handle arbitrary integer types).  I suspect this is also visible as 
an ubsan bug (that is, that these conversions will cause shifts by e.g. 
0x100000000ULL not to be detected as undefined).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions
       [not found] <bug-63862-4@http.gcc.gnu.org/bugzilla/>
  2014-11-14 17:25 ` [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions joseph at codesourcery dot com
@ 2014-11-14 17:28 ` mpolacek at gcc dot gnu.org
  2014-11-28  9:07 ` mpolacek at gcc dot gnu.org
  2014-11-28  9:08 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-14 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-11-14
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |5.0
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'll give this a try in stage3 then.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions
       [not found] <bug-63862-4@http.gcc.gnu.org/bugzilla/>
  2014-11-14 17:25 ` [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions joseph at codesourcery dot com
  2014-11-14 17:28 ` mpolacek at gcc dot gnu.org
@ 2014-11-28  9:07 ` mpolacek at gcc dot gnu.org
  2014-11-28  9:08 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-28  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Nov 28 09:06:48 2014
New Revision: 218142

URL: https://gcc.gnu.org/viewcvs?rev=218142&root=gcc&view=rev
Log:
    PR c/63862
c-family/
    * c-ubsan.c (ubsan_instrument_shift): Change the type of a MINUS_EXPR
    to op1_utype.
    * c-gimplify.c (c_gimplify_expr): Convert right operand of a shift
    expression to unsigned_type_node.
c/
    * c-typeck.c (build_binary_op) <RSHIFT_EXPR, LSHIFT_EXPR>: Don't
    convert the right operand to integer type.
cp/
    * typeck.c (cp_build_binary_op) <RSHIFT_EXPR, LSHIFT_EXPR>: Don't
    convert the right operand to integer type.
testsuite/
    * gcc.c-torture/execute/shiftopt-1.c: Don't XFAIL anymore.
    * c-c++-common/ubsan/shift-7.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-7.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-gimplify.c
    trunk/gcc/c-family/c-ubsan.c
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions
       [not found] <bug-63862-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-11-28  9:07 ` mpolacek at gcc dot gnu.org
@ 2014-11-28  9:08 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-28  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed, up to some point.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-28  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-63862-4@http.gcc.gnu.org/bugzilla/>
2014-11-14 17:25 ` [Bug c/63862] C frontend converts shift-count to int while standard wants integer promotions joseph at codesourcery dot com
2014-11-14 17:28 ` mpolacek at gcc dot gnu.org
2014-11-28  9:07 ` mpolacek at gcc dot gnu.org
2014-11-28  9:08 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).