public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59963] New: Wrong column number for warning -Woverflow
@ 2014-01-27 22:59 chengniansun at gmail dot com
  2014-01-28  0:08 ` [Bug c/59963] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: chengniansun at gmail dot com @ 2014-01-27 22:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59963

            Bug ID: 59963
           Summary: Wrong column number for warning -Woverflow
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

Gcc emits constant overflow warnings with incorrect column numbers. The column
always starts from the beginning of the statement or expression in which
overflow occurs.


$: cat imprecise-column-no-overflow.c 
extern int f(short a, short b);
int g() {
  return f(0xFFFFFFFFL, 0xFFFFFFFFL) && f(0xFFFFFFFFL, 0xFFFFFFFFL) ; 
}
$: gcc-trunk -c -Woverflow imprecise-column-no-overflow.c 
imprecise-column-no-overflow.c: In function ‘g’:
imprecise-column-no-overflow.c:3:3: warning: overflow in implicit constant
conversion [-Woverflow]
   return f(0xFFFFFFFFL, 0xFFFFFFFFL) && f(0xFFFFFFFFL, 0xFFFFFFFFL) ; 
   ^
imprecise-column-no-overflow.c:3:3: warning: overflow in implicit constant
conversion [-Woverflow]
imprecise-column-no-overflow.c:3:3: warning: overflow in implicit constant
conversion [-Woverflow]
imprecise-column-no-overflow.c:3:3: warning: overflow in implicit constant
conversion [-Woverflow]
$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/chengniansun/tools/gcc-trunk-binaries/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries :
(reconfigured) ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries
Thread model: posix
gcc version 4.9.0 20140127 (experimental) (GCC) 

$: clang-trunk -c -Woverflow imprecise-column-no-overflow.c 
imprecise-column-no-overflow.c:3:12: warning: implicit conversion from 'long'
to 'short' changes value from 4294967295 to -1 [-Wconstant-conversion]
  return f(0xFFFFFFFFL, 0xFFFFFFFFL) && f(0xFFFFFFFFL, 0xFFFFFFFFL) ; 
         ~ ^~~~~~~~~~~
imprecise-column-no-overflow.c:3:25: warning: implicit conversion from 'long'
to 'short' changes value from 4294967295 to -1 [-Wconstant-conversion]
  return f(0xFFFFFFFFL, 0xFFFFFFFFL) && f(0xFFFFFFFFL, 0xFFFFFFFFL) ; 
         ~              ^~~~~~~~~~~
imprecise-column-no-overflow.c:3:43: warning: implicit conversion from 'long'
to 'short' changes value from 4294967295 to -1 [-Wconstant-conversion]
  return f(0xFFFFFFFFL, 0xFFFFFFFFL) && f(0xFFFFFFFFL, 0xFFFFFFFFL) ; 
                                        ~ ^~~~~~~~~~~
imprecise-column-no-overflow.c:3:56: warning: implicit conversion from 'long'
to 'short' changes value from 4294967295 to -1 [-Wconstant-conversion]
  return f(0xFFFFFFFFL, 0xFFFFFFFFL) && f(0xFFFFFFFFL, 0xFFFFFFFFL) ; 
                                        ~              ^~~~~~~~~~~
4 warnings generated.
>From gcc-bugs-return-441690-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jan 27 23:01:39 2014
Return-Path: <gcc-bugs-return-441690-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15856 invoked by alias); 27 Jan 2014 23:01:38 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 15792 invoked by uid 48); 27 Jan 2014 23:01:34 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59920] [4.9 Regression] build doesn't terminate (at least after an hour)
Date: Mon, 27 Jan 2014 23:01:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59920-4-pgZ3qp4qqt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59920-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59920-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02832.txt.bz2
Content-length: 492

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY920

--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Updated patch.  Apparently we were dropping the abnormal edges during
> expansion anyway, so there is nothing to do for RTL right now.  The patch
> results in some Ada miscompares though, will debug tomorrow.

If you remove __builtin_setjmp_dispatcher, please adjust the description in the
head comment of lower_builtin_setjmp.  That's rather critical stuff for Ada...


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

* [Bug c/59963] Wrong column number for warning -Woverflow
  2014-01-27 22:59 [Bug c/59963] New: Wrong column number for warning -Woverflow chengniansun at gmail dot com
@ 2014-01-28  0:08 ` mpolacek at gcc dot gnu.org
  2014-01-31  8:14 ` mpolacek at gcc dot gnu.org
  2014-01-31  8:16 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-01-28  0:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59963

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'm handling this as a part of PR59940 fix.


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

* [Bug c/59963] Wrong column number for warning -Woverflow
  2014-01-27 22:59 [Bug c/59963] New: Wrong column number for warning -Woverflow chengniansun at gmail dot com
  2014-01-28  0:08 ` [Bug c/59963] " mpolacek at gcc dot gnu.org
@ 2014-01-31  8:14 ` mpolacek at gcc dot gnu.org
  2014-01-31  8:16 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-01-31  8:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59963

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Jan 31 08:13:50 2014
New Revision: 207335

URL: http://gcc.gnu.org/viewcvs?rev=207335&root=gcc&view=rev
Log:
    PR c/59963
c-family/
    * c-common.c (add_atomic_size_parameter): Pass vNULL to
    build_function_call_vec.
    (resolve_overloaded_builtin): Likewise.
    * c-common.h (build_function_call_vec): Adjust declaration.
cp/
    * typeck.c (build_function_call_vec): Add dummy arg_loc parameter.
c/
    * c-typeck.c (convert_lvalue_to_rvalue): Pass vNULL to
    build_function_call_vec.
    (build_function_call): Likewise.
    (build_atomic_assign): Likewise.
    (build_function_call_vec): Add arg_loc parameter.  Use it.
    (convert_arguments): Likewise.
    (convert_for_assignment): Rename rhs_loc to expr_loc.
    * c-parser.c (c_parser_attributes): Pass NULL to c_parser_expr_list.
    (c_parser_objc_keywordexpr): Likewise.
    (c_parser_postfix_expression_after_primary): Call
    build_function_call_vec with expr_loc rather than op_loc.
    Call c_parser_expr_list to fill arg_loc.  Pass arg_loc to
    build_function_call_vec.
    (c_parser_expr_list): Add locations parameter.  Fill it with locations
    of function arguments.
    * c-decl.c (finish_decl): Pass vNULL to build_function_call_vec.
objc/
    * objc-next-runtime-abi-02.c (build_throw_stmt): Pass vNULL to
    build_function_call_vec.
    (finish_catch): Likewise.
    (next_runtime_abi_02_get_class_reference): Likewise.
    * objc-next-runtime-abi-01.c (build_objc_method_call): Pass vNULL to
    build_function_call_vec.
    (build_throw_stmt): Likewise.
    * objc-gnu-runtime-abi-01.c: (build_objc_method_call): Pass vNULL to
    build_function_call_vec.
    (build_throw_stmt): Likewise.
testsuite/
    * gcc.dg/pr59940.c (g): Adjust dg-warning.
    (y): Adjust dg-error.
    * gcc.dg/cast-function-1.c (bar): Adjust dg-warnings.
    * gcc.dg/pr59963-1.c: New test.
    * gcc.dg/pr59963-2.c: New test.
    * gcc.dg/pr59963-3.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/pr59963-1.c
    trunk/gcc/testsuite/gcc.dg/pr59963-2.c
    trunk/gcc/testsuite/gcc.dg/pr59963-3.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-decl.c
    trunk/gcc/c/c-parser.c
    trunk/gcc/c/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/objc/ChangeLog
    trunk/gcc/objc/objc-gnu-runtime-abi-01.c
    trunk/gcc/objc/objc-next-runtime-abi-01.c
    trunk/gcc/objc/objc-next-runtime-abi-02.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/cast-function-1.c
    trunk/gcc/testsuite/gcc.dg/pr59940.c


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

* [Bug c/59963] Wrong column number for warning -Woverflow
  2014-01-27 22:59 [Bug c/59963] New: Wrong column number for warning -Woverflow chengniansun at gmail dot com
  2014-01-28  0:08 ` [Bug c/59963] " mpolacek at gcc dot gnu.org
  2014-01-31  8:14 ` mpolacek at gcc dot gnu.org
@ 2014-01-31  8:16 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-01-31  8:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59963

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

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Should be fixed.


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

end of thread, other threads:[~2014-01-31  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-27 22:59 [Bug c/59963] New: Wrong column number for warning -Woverflow chengniansun at gmail dot com
2014-01-28  0:08 ` [Bug c/59963] " mpolacek at gcc dot gnu.org
2014-01-31  8:14 ` mpolacek at gcc dot gnu.org
2014-01-31  8:16 ` 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).