Launchpad has imported 17 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70457.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://documentation.ubuntu.com/launchpad/user/reference/bugs/multi-project-bugs/about-multi-project-bugs/#bugs-in-external-trackers.

------------------------------------------------------------------------
On 2016-03-30T12:49:49+00:00 Doko-v wrote:

fails in 4.8 up to 6, works with -O2

$ gcc -c -O3 math.i 
math.i: In function 'P_Pow':
math.i:26:8: internal compiler error: Segmentation fault
 Object P_Pow (Object x, Object y) { return General_Function (x, y, pow); }
        ^
0x102bde83 crash_signal
        ../../src/gcc/toplev.c:383
0x1031d914 gimple_expand_builtin_pow
        ../../src/gcc/tree-ssa-math-opts.c:1169
0x10a42827 execute
        ../../src/gcc/tree-ssa-math-opts.c:1517
Please submit a full bug report,
with preprocessed source if appropriate.

$ cat math.i 
extern double pow (double __x, double __y) __attribute__ ((__nothrow__ , 
__leaf__)); extern double __pow (double __x, double __y) __attribute__ 
((__nothrow__ , __leaf__));

typedef int int64_t __attribute__ ((__mode__ (__DI__)));

typedef struct {
    int64_t data;
    int tag;
} Object;

extern Object Make_Flonum (double);
extern Object P_Pow (Object, Object);

Object General_Function (Object x, Object y, double (*fun)()) {
    double d, ret;

    d = 1.0;

    if (y.tag >> 1)
        ret = (*fun) (d);
    else
        ret = (*fun) (d, 0.0);

    return Make_Flonum (ret);
}

Object P_Pow (Object x, Object y) { return General_Function (x, y, pow);
}

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/2

------------------------------------------------------------------------
On 2016-03-30T13:06:57+00:00 Ktkachov wrote:

Confirmed on aarch64 as well

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/3

------------------------------------------------------------------------
On 2016-03-30T13:16:09+00:00 Ktkachov wrote:

Using gdb, the gimple stmt causing the ICE is:
# .MEM_10 = VDEF <.MEM_1(D)>
ret_5 = pow (1.0e+0);

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/4

------------------------------------------------------------------------
On 2016-04-01T14:30:43+00:00 Bill-schmidt wrote:

So we have an unreachable call to pow with the wrong number of
arguments.  I suppose the expansion logic for builtin_pow should
tolerate this situation and just do nothing with it.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/5

------------------------------------------------------------------------
On 2016-04-01T14:32:24+00:00 Bill-schmidt wrote:

(I should say, presumably unreachable.  This source code looks pretty
dicey in the first place, but nonetheless we should probably tolerate it
at this stage of optimization.)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/6

------------------------------------------------------------------------
On 2016-04-01T15:17:59+00:00 Bill-schmidt wrote:

Created attachment 38156
Patch that permits this to compile

The attached patch allows the compilation to succeed in spite of the
incorrect number of arguments provided to pow ().

I suppose this is a reasonable approach, but it makes me a bit queasy to
let obviously incorrect code go by undiagnosed.  Still, it's no
different than providing the wrong number of arguments to some other
function; we only notice here because we convert the function call to a
built-in.

CCing Richard for his opinion.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/7

------------------------------------------------------------------------
On 2016-04-01T15:48:34+00:00 Jakub-gcc wrote:

IMHO much better would be to call gimple_call_builtin_p (call, BUILT_IN_NORMAL)
(for non-internal functions) and only treat those as builtins if that function
returned true.  That checks both the number of arguments, roughly their types 
etc.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/8

------------------------------------------------------------------------
On 2016-04-01T15:50:46+00:00 Jakub-gcc wrote:

Ah, but gimple_call_combined_fn already performs this.
So perhaps all you need is the tree-inline.c part?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/9

------------------------------------------------------------------------
On 2016-04-01T16:04:43+00:00 Bill-schmidt wrote:

The tree-inline part only shows up after fixing the part in tree-ssa-
math-opts.c, where the initial failure occurs.  The DECL is already
encoded as a BUILT_IN_POW by the time we get that far.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/10

------------------------------------------------------------------------
On 2016-04-01T16:07:37+00:00 Jakub-gcc wrote:

I've missed the pass_optimize_widening_mul::execute in your patch, that
is also another spot where you'd want to call it.  But the sincos hunks
should be safe as is.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/11

------------------------------------------------------------------------
On 2016-04-01T16:20:35+00:00 Bill-schmidt wrote:

Ok, sounds good.  I have vacation this afternoon, but will revisit this
over the weekend or Monday.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/12

------------------------------------------------------------------------
On 2016-04-03T15:12:46+00:00 Bill-schmidt wrote:

Jakub, thanks, I've verified that works and makes for a much better
patch.  Will post shortly on gcc-patches.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/13

------------------------------------------------------------------------
On 2016-04-04T15:42:50+00:00 Bill-schmidt wrote:

Author: wschmidt
Date: Mon Apr  4 15:42:19 2016
New Revision: 234716

URL: https://gcc.gnu.org/viewcvs?rev=234716&root=gcc&view=rev
Log:
[gcc]

2016-04-04  Bill Schmidt  <[email protected]>
            Jakub Jelinek <[email protected]>

        PR middle-end/70457
        * tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p
        to ensure a call statement is compatible with a built-in's
        prototype.
        * tree-ssa-math-opts.c (pass_optimize_windening_mul::execute):
        Likewise.

[gcc/testsuite]

2016-04-04  Bill Schmidt  <[email protected]>
            Jakub Jelinek <[email protected]>

        PR middle-end/70457
        * gcc.dg/torture/pr70457.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr70457.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c
    trunk/gcc/tree-ssa-math-opts.c

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/14

------------------------------------------------------------------------
On 2016-04-04T15:46:30+00:00 Bill-schmidt wrote:

Author: wschmidt
Date: Mon Apr  4 15:45:59 2016
New Revision: 234717

URL: https://gcc.gnu.org/viewcvs?rev=234717&root=gcc&view=rev
Log:
[gcc]

2016-04-04  Bill Schmidt  <[email protected]>
            Jakub Jelinek <[email protected]>

        PR middle-end/70457
        * tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p
        to ensure a call statement is compatible with a built-in's
        prototype.
        * tree-ssa-math-opts.c (execute_cse_sincos_1): Likewise.
        (pass_cse_sincos::execute): Likewise.
        (pass_optimize_widening_mul::execute):  Likewise.

[gcc/testsuite]

2016-04-04  Bill Schmidt  <[email protected]>
            Jakub Jelinek <[email protected]>

        PR middle-end/70457
        * gcc.dg/torture/pr70457.c: New.


Added:
    branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr70457.c
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
    branches/gcc-5-branch/gcc/tree-inline.c
    branches/gcc-5-branch/gcc/tree-ssa-math-opts.c

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/15

------------------------------------------------------------------------
On 2016-04-04T15:48:25+00:00 Bill-schmidt wrote:

Author: wschmidt
Date: Mon Apr  4 15:47:51 2016
New Revision: 234718

URL: https://gcc.gnu.org/viewcvs?rev=234718&root=gcc&view=rev
Log:
[gcc]

2016-04-04  Bill Schmidt  <[email protected]>
            Jakub Jelinek <[email protected]>

        PR middle-end/70457
        * tree-inline.c (estimate_num_insn): Use gimple_call_builtin_p
        to ensure a call statement is compatible with a built-in's
        prototype.
        * tree-ssa-math-opts.c (execute_cse_sincos_1): Likewise.
        (execute_cse_sincos): Likewise.
        (execute_optimize_widening_mul): Likewise.

[gcc/testsuite]

2016-04-04  Bill Schmidt  <[email protected]>
            Jakub Jelinek <[email protected]>

        PR middle-end/70457
        * gcc.dg/torture/pr70457.c: New.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr70457.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-inline.c
    branches/gcc-4_9-branch/gcc/tree-ssa-math-opts.c

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/16

------------------------------------------------------------------------
On 2016-04-04T15:49:23+00:00 Bill-schmidt wrote:

Matthias, the code is now fixed everywhere upstream.  Do you need a
merge into ibm/gcc-5-branch?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/17

------------------------------------------------------------------------
On 2016-04-04T15:49:53+00:00 Bill-schmidt wrote:

Fixed.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563134/comments/18


** Changed in: gcc
       Status: Unknown => Fix Released

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1563134

Title:
  ICE in gimple_expand_builtin_pow with -O3 on ppc64el

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1563134/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to