public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression
@ 2014-10-21  9:39 yueming.yang at huawei dot com
  2014-10-23 19:16 ` [Bug middle-end/63608] [4.8/4.9 Regression] error: " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: yueming.yang at huawei dot com @ 2014-10-21  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63608
           Summary: [4.8 Regression]error: type mismatch in binary
                    expression
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yueming.yang at huawei dot com

Created attachment 33765
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33765&action=edit
testcase

gcc hello.c -S -O2  -w  -m32 -v

Using built-in specs.
COLLECT_GCC=x86_install/bin/gcc
Target: x86_64-unknown-linux-gnu
Configured with: gcc-4.8-branch/configure --prefix=x86_install
--enable-languages=c,c++ --enable-threads=posix --disable-multilib
--with-system-zlib --disable-nls --enable-__cxa_atexit --enable-checking
--with-system-zlib --enable-lto --disable-bootstrap
Thread model: posix
gcc version 4.8.4 20140911 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-S' '-O2' '-w' '-m32' '-v' '-mtune=generic'
'-march=x86-64'
 x86_install/libexec/gcc/x86_64-unknown-linux-gnu/4.8.4/cc1 -quiet -v
-imultilib . hello.c -quiet -dumpbase hello.c -m32 -mtune=generic -march=x86-64
-auxbase hello -O2 -w -version -o hello.s
GNU C (GCC) version 4.8.4 20140911 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.4, GMP version 5.1.3, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"x86_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 x86_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/include
 /usr/local/include
 x86_install/include
 x86_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/include-fixed
 /usr/include
End of search list.
GNU C (GCC) version 4.8.4 20140911 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.4, GMP version 5.1.3, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 741d6eabab2d80d9f09742b3a0e5d8b6
hello.c: In function 'fn1':
hello.c:7:5: error: type mismatch in binary expression
 int fn1 ()
     ^
long int

long int

long unsigned int

D.1709 = D.1708 | 2248593032;

hello.c:7:5: internal compiler error: verify_gimple failed
0xa9362b verify_gimple_in_seq(gimple_statement_d*)
        gcc-4.8-branch/gcc/tree-cfg.c:4515
0x86182c gimplify_body(tree_node*, bool)
        gcc-4.8-branch/gcc/gimplify.c:8421
0x861aef gimplify_function_tree(tree_node*)
        gcc-4.8-branch/gcc/gimplify.c:8534
0x6a8903 cgraph_analyze_function
        gcc-4.8-branch/gcc/cgraphunit.c:665
0x6ab3f0 cgraph_analyze_functions
       gcc-4.8-branch/gcc/cgraphunit.c:973
0x6ab87f finalize_compilation_unit()
        gcc-4.8-branch/gcc/cgraphunit.c:2119
0x54e284 c_write_global_declarations()
        gcc-4.8-branch/gcc/c/c-decl.c:10120
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
@ 2014-10-23 19:16 ` mpolacek at gcc dot gnu.org
  2014-12-10 13:16 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-10-23 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-23
          Component|c                           |middle-end
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|[4.8 Regression]error: type |[4.8/4.9 Regression] error:
                   |mismatch in binary          |type mismatch in binary
                   |expression                  |expression
   Target Milestone|---                         |4.8.4
           Severity|critical                    |normal

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This worked with 4.4, broken with 4.[56789], doesn't ICE with trunk where it
was fixed by r210518.  I think this is backportable.


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
  2014-10-23 19:16 ` [Bug middle-end/63608] [4.8/4.9 Regression] error: " mpolacek at gcc dot gnu.org
@ 2014-12-10 13:16 ` rguenth at gcc dot gnu.org
  2014-12-11  8:48 ` ebotcazou at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-10 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking,
                   |                            |ice-on-valid-code
           Priority|P3                          |P2
                 CC|                            |ebotcazou at gcc dot gnu.org


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
  2014-10-23 19:16 ` [Bug middle-end/63608] [4.8/4.9 Regression] error: " mpolacek at gcc dot gnu.org
  2014-12-10 13:16 ` rguenth at gcc dot gnu.org
@ 2014-12-11  8:48 ` ebotcazou at gcc dot gnu.org
  2014-12-19 13:43 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2014-12-11  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
But the testcase looks completely artificial and this ICEs only because the
compiler is configured with --enable-checking.


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
                   ` (2 preceding siblings ...)
  2014-12-11  8:48 ` ebotcazou at gcc dot gnu.org
@ 2014-12-19 13:43 ` jakub at gcc dot gnu.org
  2015-02-25 14:13 ` ktietz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-19 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.4                       |4.8.5

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.4 has been released.


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
                   ` (3 preceding siblings ...)
  2014-12-19 13:43 ` jakub at gcc dot gnu.org
@ 2015-02-25 14:13 ` ktietz at gcc dot gnu.org
  2015-06-12  9:06 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-02-25 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu.org

--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Issue is fixed on 5.0 gcc.  But confirm that issue still exists on 4.9 branch.


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
                   ` (4 preceding siblings ...)
  2015-02-25 14:13 ` ktietz at gcc dot gnu.org
@ 2015-06-12  9:06 ` jakub at gcc dot gnu.org
  2015-06-12 11:53 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-12  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Less artificially looking testcase.

/* PR middle-end/63608 */

typedef long T;
typedef unsigned long U;
unsigned long a;

unsigned long
foo (int b)
{
  T c = 0;
  const U d = 2248593032UL;
  a = (c = +d) | (~4L & ~b);
  return c;
}

Testing the backport now, seems fold-const.c pretty much assumes everywhere
that if argN is INTEGER_CST, then argN == opN, but the missing NON_LVALUE_EXPR
case of course breaks this.  So, fixing it at the spots that just pass argN if
it is known to be INTEGER_CST is not really doable.
If the patch would be too dangerous (most likely is not), then another option
is just to fold NON_LVALUE_EXPR of INTEGER_CST to the INTEGER_CST.


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
                   ` (5 preceding siblings ...)
  2015-06-12  9:06 ` jakub at gcc dot gnu.org
@ 2015-06-12 11:53 ` jakub at gcc dot gnu.org
  2015-06-12 11:54 ` jakub at gcc dot gnu.org
  2015-06-12 11:57 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-12 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Jun 12 11:52:42 2015
New Revision: 224418

URL: https://gcc.gnu.org/viewcvs?rev=224418&root=gcc&view=rev
Log:
        PR middle-end/63608
        * gcc.c-torture/compile/pr63608.c: New test.

        Backported from mainline
        2014-05-16  Eric Botcazou  <ebotcazou@adacore.com>

        * fold-const (fold_unary_loc) <NON_LVALUE_EXPR>: New case.
        <CASE_CONVERT>: Pass arg0 instead of op0 to fold_convert_const.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/compile/pr63608.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/fold-const.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
                   ` (6 preceding siblings ...)
  2015-06-12 11:53 ` jakub at gcc dot gnu.org
@ 2015-06-12 11:54 ` jakub at gcc dot gnu.org
  2015-06-12 11:57 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-12 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Jun 12 11:53:34 2015
New Revision: 224419

URL: https://gcc.gnu.org/viewcvs?rev=224419&root=gcc&view=rev
Log:
        PR middle-end/63608
        * gcc.c-torture/compile/pr63608.c: New test.

        Backported from mainline
        2014-05-16  Eric Botcazou  <ebotcazou@adacore.com>

        * fold-const (fold_unary_loc) <NON_LVALUE_EXPR>: New case.
        <CASE_CONVERT>: Pass arg0 instead of op0 to fold_convert_const.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/compile/pr63608.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/fold-const.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
  2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
                   ` (7 preceding siblings ...)
  2015-06-12 11:54 ` jakub at gcc dot gnu.org
@ 2015-06-12 11:57 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-12 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-06-12 11:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-21  9:39 [Bug c/63608] New: [4.8 Regression]error: type mismatch in binary expression yueming.yang at huawei dot com
2014-10-23 19:16 ` [Bug middle-end/63608] [4.8/4.9 Regression] error: " mpolacek at gcc dot gnu.org
2014-12-10 13:16 ` rguenth at gcc dot gnu.org
2014-12-11  8:48 ` ebotcazou at gcc dot gnu.org
2014-12-19 13:43 ` jakub at gcc dot gnu.org
2015-02-25 14:13 ` ktietz at gcc dot gnu.org
2015-06-12  9:06 ` jakub at gcc dot gnu.org
2015-06-12 11:53 ` jakub at gcc dot gnu.org
2015-06-12 11:54 ` jakub at gcc dot gnu.org
2015-06-12 11:57 ` jakub 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).