public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/40348] New: Powerpc spe segfaults in vectorizing powf (a[i], 0.5f)
@ 2009-06-04 21:17 meissner at gcc dot gnu dot org
2009-06-04 21:19 ` [Bug tree-optimization/40348] " meissner at gcc dot gnu dot org
2009-06-07 8:00 ` irar at il dot ibm dot com
0 siblings, 2 replies; 4+ messages in thread
From: meissner at gcc dot gnu dot org @ 2009-06-04 21:17 UTC (permalink / raw)
To: gcc-bugs
I was testing the power7 changes by building a powerpc-spe-eabi compiler to
make sure I hadn't broken anything, and I trying compiling a vector test that I
have that does almost all operations and sees whether the compiler vectorizes
it. When I compile the tests of power (a[i], 0.5f), which is supposed to
optimize the code into sqrt with -O3 and -ffast-math, the compiler segfaults.
This case fails for the mainline as well as my branch.
-etna-> gdb cc1
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "ppc-suse-linux"...
Using host libthread_db library "/lib/power6/libthread_db.so.1".
Breakpoint 1 at 0x1019e678: file /home/meissner/fsf-src/trunk/gcc/diagnostic.c,
line 730.
Breakpoint 2 at 0x1019e5d4: file /home/meissner/fsf-src/trunk/gcc/diagnostic.c,
line 670.
Breakpoint 3 at 0x108b1af0
Breakpoint 4 at 0x108b17f0
(gdb) r -O3 -mspe -quiet -ffast-math vect.i -o vect-O3.s
Starting program: /home/meissner/fsf-build-ppc32/trunk-spe/gcc/cc1 -O3 -mspe
-quiet -ffast-math vect.i -o vect-O3.s
Breakpoint 3 at 0xfea3298: file exit.c, line 34.
Breakpoint 4 at 0xfea1af8: file abort.c, line 50.
Program received signal SIGSEGV, Segmentation fault.
gimple_build_call (fn=0x0, nargs=1) at
/home/meissner/fsf-src/trunk/gcc/gimple.c:319
319 gcc_assert (TREE_CODE (fn) == FUNCTION_DECL || is_gimple_call_addr
(fn));
(gdb) print fn
$1 = (tree) 0x0
(gdb) list
314 {
315 va_list ap;
316 gimple call;
317 unsigned i;
318
319 gcc_assert (TREE_CODE (fn) == FUNCTION_DECL || is_gimple_call_addr
(fn));
320
321 call = gimple_build_call_1 (fn, nargs);
322
323 va_start (ap, nargs);
(gdb) list -
304
305 return call;
306 }
307
308
309 /* Build a GIMPLE_CALL statement to function FN. NARGS is the number
of
310 arguments. The ... are the arguments. */
311
312 gimple
313 gimple_build_call (tree fn, unsigned nargs, ...)
(gdb) list -
294
295 gimple
296 gimple_build_call_vec (tree fn, VEC(tree, heap) *args)
297 {
298 unsigned i;
299 unsigned nargs = VEC_length (tree, args);
300 gimple call = gimple_build_call_1 (fn, nargs);
301
302 for (i = 0; i < nargs; i++)
303 gimple_call_set_arg (call, i, VEC_index (tree, args, i));
(gdb) up
#1 0x1081d2ec in vect_recog_pow_pattern (last_stmt=<value optimized out>,
type_in=0xffdeec70, type_out=<value optimized out>) at
/home/meissner/fsf-src/trunk/gcc/tree-vect-patterns.c:521
521 gimple stmt = gimple_build_call (newfn, 1, base);
(gdb) print newfn
$2 = (tree) 0x0
(gdb) list
516 {
517 tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
518 *type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
519 if (*type_in)
520 {
521 gimple stmt = gimple_build_call (newfn, 1, base);
522 if (vectorizable_function (stmt, *type_in, *type_in)
523 != NULL_TREE)
524 {
525 var = vect_recog_temp_ssa_var (TREE_TYPE (base), stmt);
(gdb) list -
506
507 var = vect_recog_temp_ssa_var (TREE_TYPE (base), NULL);
508 stmt = gimple_build_assign_with_ops (MULT_EXPR, var, base, base);
509 SSA_NAME_DEF_STMT (var) = stmt;
510 return stmt;
511 }
512
513 /* Catch square root. */
514 if (TREE_CODE (exp) == REAL_CST
515 && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconsthalf))
(gdb) list 506
501 && tree_low_cst (exp, 0) == 2)
502 || (TREE_CODE (exp) == REAL_CST
503 && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst2)))
504 {
505 *type_in = TREE_TYPE (base);
506
507 var = vect_recog_temp_ssa_var (TREE_TYPE (base), NULL);
508 stmt = gimple_build_assign_with_ops (MULT_EXPR, var, base, base);
509 SSA_NAME_DEF_STMT (var) = stmt;
510 return stmt;
(gdb)
511 }
512
513 /* Catch square root. */
514 if (TREE_CODE (exp) == REAL_CST
515 && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconsthalf))
516 {
517 tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
518 *type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
519 if (*type_in)
520 {
As you can see, the mathfn_built_in is returning NULL, but the code assumes it
is non-null. I will upload a reduced test case as an attachment.
--
Summary: Powerpc spe segfaults in vectorizing powf (a[i], 0.5f)
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: meissner at gcc dot gnu dot org
GCC build triplet: powerpc64-unknown-linux-gnu
GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: powerpc-spe-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40348
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/40348] Powerpc spe segfaults in vectorizing powf (a[i], 0.5f)
2009-06-04 21:17 [Bug tree-optimization/40348] New: Powerpc spe segfaults in vectorizing powf (a[i], 0.5f) meissner at gcc dot gnu dot org
@ 2009-06-04 21:19 ` meissner at gcc dot gnu dot org
2009-06-07 8:00 ` irar at il dot ibm dot com
1 sibling, 0 replies; 4+ messages in thread
From: meissner at gcc dot gnu dot org @ 2009-06-04 21:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from meissner at gcc dot gnu dot org 2009-06-04 21:19 -------
Created an attachment (id=17952)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17952&action=view)
Reduced test case
Compile with -O3 -ffast-math -mspe on a compiler configured for
powerpc-spe-eabi.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40348
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/40348] Powerpc spe segfaults in vectorizing powf (a[i], 0.5f)
2009-06-04 21:17 [Bug tree-optimization/40348] New: Powerpc spe segfaults in vectorizing powf (a[i], 0.5f) meissner at gcc dot gnu dot org
2009-06-04 21:19 ` [Bug tree-optimization/40348] " meissner at gcc dot gnu dot org
@ 2009-06-07 8:00 ` irar at il dot ibm dot com
1 sibling, 0 replies; 4+ messages in thread
From: irar at il dot ibm dot com @ 2009-06-07 8:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from irar at il dot ibm dot com 2009-06-07 07:59 -------
So, I guess this patch fixes it?
Thanks,
Ira
Index: tree-vect-patterns.c
===================================================================
--- tree-vect-patterns.c (revision 148035)
+++ tree-vect-patterns.c (working copy)
@@ -515,6 +515,9 @@ vect_recog_pow_pattern (gimple last_stmt
&& REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconsthalf))
{
tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
+ if (!newfn)
+ return NULL;
+
*type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
if (*type_in)
{
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40348
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/40348] Powerpc spe segfaults in vectorizing powf (a[i], 0.5f)
[not found] <bug-40348-4@http.gcc.gnu.org/bugzilla/>
@ 2011-12-09 18:34 ` meissner at gcc dot gnu.org
0 siblings, 0 replies; 4+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-12-09 18:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40348
Michael Meissner <meissner at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WORKSFORME
--- Comment #3 from Michael Meissner <meissner at gcc dot gnu.org> 2011-12-09 18:28:28 UTC ---
With the current snapshot of the development GCC 4.7 and also the current GCC
4.6.3, I no longer get a trap, and it generates the expected code.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-09 18:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-04 21:17 [Bug tree-optimization/40348] New: Powerpc spe segfaults in vectorizing powf (a[i], 0.5f) meissner at gcc dot gnu dot org
2009-06-04 21:19 ` [Bug tree-optimization/40348] " meissner at gcc dot gnu dot org
2009-06-07 8:00 ` irar at il dot ibm dot com
[not found] <bug-40348-4@http.gcc.gnu.org/bugzilla/>
2011-12-09 18:34 ` meissner 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).