This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [testsuite] Fix gcc.dg/ipa/ipa-icf-2[18].c on Solaris


On 10/23/2014 04:03 PM, Uros Bizjak wrote:
On Thu, Oct 23, 2014 at 3:54 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

Ok, will try that.  Still no idea why Linux/x86 and Solaris/x86 are
different here.

Why do you think so?  I certainly have:
FAIL: gcc.dg/ipa/ipa-icf-21.c (test for excess errors)
UNRESOLVED: gcc.dg/ipa/ipa-icf-21.c scan-ipa-dump icf "Equal symbols: 1"
UNRESOLVED: gcc.dg/ipa/ipa-icf-21.c scan-ipa-dump icf "Semantic equality
hit:bar->foo"
in my i686-linux test_summary log.  It really depends on how the compiler

Right, but on i386-pc-solaris2.11 it passes.

is configured, if it defaults to march that has sse/sse2 by default, it will
succeed, otherwise it will not.

For some reason, I hit a division by zero on alphaev68-linux-gnu in
the report generation code:

Starting program: /space/uros/gcc-build/prev-gcc/cc1 -O2
-fdump-ipa-icf -quiet ipa-icf-14.i

Program received signal SIGFPE, Arithmetic exception.
ipa_icf::sem_item_optimizer::merge_classes (this=0x12187dd80,
prev_class_count=3) at
/space/homedirs/uros/gcc-svn/trunk/gcc/ipa-icf.c:2203
2203                   non_singular_classes_count);
(gdb) list
2198          fprintf (dump_file, "Average class size before: %.2f,
after: %.2f\n",
2199                   1.0f * item_count / prev_class_count,
2200                   1.0f * item_count / class_count);
2201          fprintf (dump_file, "Average non-singular class size:
%.2f, count: %u\n",
2202                   1.0f * non_singular_classes_sum /
non_singular_classes_count,
2203                   non_singular_classes_count);
2204          fprintf (dump_file, "Equal symbols: %u\n", equal_items);
2205          fprintf (dump_file, "Fraction of visited symbols: %.2f%%\n\n",
2206                   100.0f * equal_items / item_count);
2207        }
(gdb) p non_singular_classes_count
$1 = 0

Also:

(gdb) p non_singular_classes_sum
$1 = 0

This creates a nice NaN which can throw an exception.

Hello.

Sorry for a stupid bug. I attached patch that should fix these divisions by zero.
I'm just wondering if we have a machine in compile farm with alpha?

Thanks,
Martin


(gdb) bt
#0  ipa_icf::sem_item_optimizer::merge_classes (this=0x12187dd80,
prev_class_count=3)
     at /space/homedirs/uros/gcc-svn/trunk/gcc/ipa-icf.c:2203
#1  0x0000000121255c70 in ipa_icf::sem_item_optimizer::execute
(this=0x12187dd80) at
/space/homedirs/uros/gcc-svn/trunk/gcc/ipa-icf.c:1602
#2  0x000000012125999c in ipa_icf::ipa_icf_driver () at
/space/homedirs/uros/gcc-svn/trunk/gcc/ipa-icf.c:2319
#3  0x000000012125a46c in ipa_icf::pass_ipa_icf::execute
(this=0x121850f20) at
/space/homedirs/uros/gcc-svn/trunk/gcc/ipa-icf.c:2367
#4  0x00000001209c10c4 in execute_one_pass (pass=0x121850f20) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2156
#5  0x00000001209c26f4 in execute_ipa_pass_list (pass=0x121850f20) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2550
#6  0x000000012048fcdc in ipa_passes () at
/space/homedirs/uros/gcc-svn/trunk/gcc/cgraphunit.c:2057

Uros.


diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index d1238a4..e7a293e 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -1736,7 +1736,7 @@ sem_item_optimizer::parse_nonsingleton_classes (void)
 
   if (dump_file)
     fprintf (dump_file, "Init called for %u items (%.2f%%).\n", init_called_count,
-	     100.0f * init_called_count / m_items.length ());
+	     m_items.length () ? 100.0f * init_called_count / m_items.length (): 0.0f);
 }
 
 /* Equality function for semantic items is used to subdivide existing
@@ -2196,14 +2196,15 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count)
       fprintf (dump_file, "Congruent classes before: %u, after: %u\n",
 	       prev_class_count, class_count);
       fprintf (dump_file, "Average class size before: %.2f, after: %.2f\n",
-	       1.0f * item_count / prev_class_count,
-	       1.0f * item_count / class_count);
+	       prev_class_count ? 1.0f * item_count / prev_class_count : 0.0f,
+	       class_count ? 1.0f * item_count / class_count : 0.0f);
       fprintf (dump_file, "Average non-singular class size: %.2f, count: %u\n",
-	       1.0f * non_singular_classes_sum / non_singular_classes_count,
+	       non_singular_classes_count ? 1.0f * non_singular_classes_sum /
+	       non_singular_classes_count : 0.0f,
 	       non_singular_classes_count);
       fprintf (dump_file, "Equal symbols: %u\n", equal_items);
       fprintf (dump_file, "Fraction of visited symbols: %.2f%%\n\n",
-	       100.0f * equal_items / item_count);
+	       item_count ? 100.0f * equal_items / item_count : 0.0f);
     }
 
   for (hash_table<congruence_class_group_hash>::iterator it = m_classes.begin ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]