This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/60761] Names of all function clones in g++ are "<built-in>", in both warnings and dumps
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 05 Apr 2014 16:25:09 +0000
- Subject: [Bug ipa/60761] Names of all function clones in g++ are "<built-in>", in both warnings and dumps
- Auto-submitted: auto-generated
- References: <bug-60761-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60761
--- Comment #3 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #2)
> (In reply to Martin Jambor from comment #0)
> > mjambor@virgil:~/gcc/bisect/test/clonenames$ ~/gcc/bisect/inst/bin/g++ -O3
> > -S -Wall zz.C -fno-inline
> > zz.C: In function â<built-in>â:
> > zz.C:14:13: warning: iteration 3u invokes undefined behavior
> > [-Waggressive-loop-optimizations]
> > z[i] = i;
> > ^
>
> What is 3u?
>
> > zz.C:13:3: note: containing loop
>
> Wouldn't be more clear to say "within this loop"?
>
I really cannot believe that after all this time, there is no printf-like code
to print a double_int. Why not %I? Interestingly, there is pp_double_int, so it
is obvious to me that this %E trick is just an ugly hack.
Index: tree-ssa-loop-niter.c
===================================================================
--- tree-ssa-loop-niter.c (revision 208648)
+++ tree-ssa-loop-niter.c (working copy)
@@ -2626,15 +2626,17 @@ do_warn_aggressive_loop_optimizations (s
edge e = single_exit (loop);
if (e == NULL)
return;
gimple estmt = last_stmt (e->src);
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
if (warning_at (gimple_location (stmt), OPT_Waggressive_loop_optimizations,
- "iteration %E invokes undefined behavior",
- double_int_to_tree (TREE_TYPE (loop->nb_iterations),
- i_bound)))
- inform (gimple_location (estmt), "containing loop");
+ "iteration %I invokes undefined behavior",
+ i_bound, TYPE_UNSIGNED (TREE_TYPE (loop->nb_iterations))))
+ inform (gimple_location (estmt), "within this loop");
+
loop->warned_aggressive_loop_optimizations = true;
}
/* Records that AT_STMT is executed at most BOUND + 1 times in LOOP. IS_EXIT
is true if the loop is exited immediately after STMT, and this exit
Index: tree-pretty-print.c
===================================================================
--- tree-pretty-print.c (revision 208648)
+++ tree-pretty-print.c (working copy)
@@ -3435,32 +3435,8 @@ dump_function_header (FILE *dump_file, t
}
else
fprintf (dump_file, ")\n\n");
}
-/* Dump double_int D to pretty_printer PP. UNS is true
- if D is unsigned and false otherwise. */
-void
-pp_double_int (pretty_printer *pp, double_int d, bool uns)
-{
- if (d.fits_shwi ())
- pp_wide_integer (pp, d.low);
- else if (d.fits_uhwi ())
- pp_unsigned_wide_integer (pp, d.low);
- else
- {
- unsigned HOST_WIDE_INT low = d.low;
- HOST_WIDE_INT high = d.high;
- if (!uns && d.is_negative ())
- {
- pp_minus (pp);
- high = ~high + !low;
- low = -low;
- }
- /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
- systems? */
- sprintf (pp_buffer (pp)->digit_buffer,
- HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- (unsigned HOST_WIDE_INT) high, low);
- pp_string (pp, pp_buffer (pp)->digit_buffer);
- }
-}
+
+
+
Index: pretty-print.c
===================================================================
--- pretty-print.c (revision 208648)
+++ pretty-print.c (working copy)
@@ -22,11 +22,12 @@ along with GCC; see the file COPYING3.
#include "system.h"
#include "coretypes.h"
#include "intl.h"
#include "pretty-print.h"
#include "diagnostic-color.h"
-
+#include "double-int.h"
+extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
#include <new> // For placement-new.
#if HAVE_ICONV
#include <iconv.h>
#endif
@@ -261,10 +262,11 @@ pp_indent (pretty_printer *pp)
%': apostrophe (should only be used in untranslated messages;
translations should use appropriate punctuation directly).
%.*s: a substring the length of which is specified by an argument
integer.
%Ns: likewise, but length specified as constant in the format string.
+ %I: double_int
Flag 'q': quote formatted text (must come immediately after '%').
Arguments can be used sequentially, or through %N$ resp. *N$
notation Nth argument after the format string. If %N$ / *N$
notation is used, it must be used for all arguments, except %m, %%,
@@ -605,10 +607,19 @@ pp_format (pretty_printer *pp, text_info
s = va_arg (*text->args_ptr, const char *);
pp_append_text (pp, s, s + n);
}
break;
+
+ case 'I':
+ {
+ double_int i = va_arg (*text->args_ptr, double_int);
+ bool uns = va_arg (*text->args_ptr, int);
+ pp_double_int (pp, i, uns);
+ }
+ break;
+
default:
{
bool ok;
gcc_assert (pp_format_decoder (pp));
@@ -896,10 +907,38 @@ pp_character (pretty_printer *pp, int c)
}
obstack_1grow (pp_buffer (pp)->obstack, c);
++pp_buffer (pp)->line_length;
}
+/* Dump double_int D to pretty_printer PP. UNS is true
+ if D is unsigned and false otherwise. */
+void
+pp_double_int (pretty_printer *pp, double_int d, bool uns)
+{
+ if (d.fits_shwi ())
+ pp_wide_integer (pp, d.low);
+ else if (d.fits_uhwi ())
+ pp_unsigned_wide_integer (pp, d.low);
+ else
+ {
+ unsigned HOST_WIDE_INT low = d.low;
+ HOST_WIDE_INT high = d.high;
+ if (!uns && d.is_negative ())
+ {
+ pp_minus (pp);
+ high = ~high + !low;
+ low = -low;
+ }
+ /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
+ systems? */
+ sprintf (pp_buffer (pp)->digit_buffer,
+ HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+ (unsigned HOST_WIDE_INT) high, low);
+ pp_string (pp, pp_buffer (pp)->digit_buffer);
+ }
+}
+
/* Append a STRING to the output area of PRETTY-PRINTER; the STRING may
be line-wrapped if in appropriate mode. */
void
pp_string (pretty_printer *pp, const char *str)
{