* [buildbot] r201513: Invalid cast
[not found] <20130805220945.22067.qmail@sourceware.org>
@ 2013-08-06 11:27 ` Jan-Benedict Glaw
2013-08-06 21:21 ` Oleg Endo
0 siblings, 1 reply; 3+ messages in thread
From: Jan-Benedict Glaw @ 2013-08-06 11:27 UTC (permalink / raw)
To: Oleg Endo; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 2774 bytes --]
Hi!
On Mon, 2013-08-05 22:09:45 -0000, olegendo@gcc.gnu.org <olegendo@gcc.gnu.org> wrote:
> Author: olegendo
> Date: Mon Aug 5 22:09:45 2013
> New Revision: 201513
>
> URL: http://gcc.gnu.org/viewcvs?rev=201513&root=gcc&view=rev
> Log:
> PR other/12081
> * recog.h (rtx (*insn_gen_fn) (rtx, ...)): Replace typedef with new
> class insn_gen_fn.
> * expr.c (move_by_pieces_1, store_by_pieces_2): Replace argument
> rtx (*) (rtx, ...) with insn_gen_fn.
> * genoutput.c (output_insn_data): Cast gen_? function pointers to
> insn_gen_fn::stored_funcptr. Add initializer braces.
This probably caused in a powerpc64-linux build:
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -I. -I../../../../gcc/gcc -I../../../../gcc/gcc/. -I../../../../gcc/gcc/../include -I../../../../gcc/gcc/../libcpp/include -I../../../../gcc/gcc/../libdecnumber -I../../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../../gcc/gcc/../libbacktrace \
../../../../gcc/gcc/config/rs6000/rs6000.c -o rs6000.o
In file included from ../../../../gcc/gcc/config/rs6000/rs6000.c:36:0:
../../../../gcc/gcc/config/rs6000/rs6000.c: In function ‘void rs6000_emit_swdiv(rtx, rtx, rtx, bool)’:
../../../../gcc/gcc/optabs.h:47:46: error: invalid cast from type ‘const insn_gen_fn’ to type ‘gen_2arg_fn_t {aka rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)}’
#define GEN_FCN(CODE) (insn_data[CODE].genfun)
^
../../../../gcc/gcc/config/rs6000/rs6000.c:28145:43: note: in expansion of macro ‘GEN_FCN’
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
^
../../../../gcc/gcc/config/rs6000/rs6000.c: In function ‘void rs6000_emit_swrsqrt(rtx, rtx)’:
../../../../gcc/gcc/optabs.h:47:46: error: invalid cast from type ‘const insn_gen_fn’ to type ‘gen_2arg_fn_t {aka rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)}’
#define GEN_FCN(CODE) (insn_data[CODE].genfun)
^
../../../../gcc/gcc/config/rs6000/rs6000.c:28223:43: note: in expansion of macro ‘GEN_FCN’
gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
^
Other PPC/RS6k targets (ie. rs6000-ibm-aix4.3, ...) seem to be equally
affected.
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de +49-172-7608481
Signature of: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
the second :
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [buildbot] r201513: Invalid cast
2013-08-06 11:27 ` [buildbot] r201513: Invalid cast Jan-Benedict Glaw
@ 2013-08-06 21:21 ` Oleg Endo
2013-08-06 23:14 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Oleg Endo @ 2013-08-06 21:21 UTC (permalink / raw)
To: Jan-Benedict Glaw; +Cc: gcc-patches, Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 4114 bytes --]
On Tue, 2013-08-06 at 13:27 +0200, Jan-Benedict Glaw wrote:
> Hi!
>
> On Mon, 2013-08-05 22:09:45 -0000, olegendo@gcc.gnu.org <olegendo@gcc.gnu.org> wrote:
> > Author: olegendo
> > Date: Mon Aug 5 22:09:45 2013
> > New Revision: 201513
> >
> > URL: http://gcc.gnu.org/viewcvs?rev=201513&root=gcc&view=rev
> > Log:
> > PR other/12081
> > * recog.h (rtx (*insn_gen_fn) (rtx, ...)): Replace typedef with new
> > class insn_gen_fn.
> > * expr.c (move_by_pieces_1, store_by_pieces_2): Replace argument
> > rtx (*) (rtx, ...) with insn_gen_fn.
> > * genoutput.c (output_insn_data): Cast gen_? function pointers to
> > insn_gen_fn::stored_funcptr. Add initializer braces.
>
> This probably caused in a powerpc64-linux build:
>
> g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -I. -I../../../../gcc/gcc -I../../../../gcc/gcc/. -I../../../../gcc/gcc/../include -I../../../../gcc/gcc/../libcpp/include -I../../../../gcc/gcc/../libdecnumber -I../../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../../gcc/gcc/../libbacktrace \
> ../../../../gcc/gcc/config/rs6000/rs6000.c -o rs6000.o
> In file included from ../../../../gcc/gcc/config/rs6000/rs6000.c:36:0:
> ../../../../gcc/gcc/config/rs6000/rs6000.c: In function âvoid rs6000_emit_swdiv(rtx, rtx, rtx, bool)â:
> ../../../../gcc/gcc/optabs.h:47:46: error: invalid cast from type âconst insn_gen_fnâ to type âgen_2arg_fn_t {aka rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)}â
> #define GEN_FCN(CODE) (insn_data[CODE].genfun)
> ^
> ../../../../gcc/gcc/config/rs6000/rs6000.c:28145:43: note: in expansion of macro âGEN_FCNâ
> gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
> ^
> ../../../../gcc/gcc/config/rs6000/rs6000.c: In function âvoid rs6000_emit_swrsqrt(rtx, rtx)â:
> ../../../../gcc/gcc/optabs.h:47:46: error: invalid cast from type âconst insn_gen_fnâ to type âgen_2arg_fn_t {aka rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)}â
> #define GEN_FCN(CODE) (insn_data[CODE].genfun)
> ^
> ../../../../gcc/gcc/config/rs6000/rs6000.c:28223:43: note: in expansion of macro âGEN_FCNâ
> gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
> ^
>
> Other PPC/RS6k targets (ie. rs6000-ibm-aix4.3, ...) seem to be equally
> affected.
That gen_2arg_fn_t typedef looks strange. In other places where GEN_FCN
is used in similar ways in rs6000.c, there's no cast to a function
pointer with an explicit number of arguments. It's not clear to me what
it's trying to achieve there.
I've briefly tested the attached patch by building a powerpc-elf cross
compiler with make all-gcc and checking that it can produce some
assembly code. Is this OK for trunk?
Speaking of GEN_FCN usage in rs6000.c. The recently added HTM builtin
code has one interesting piece:
static rtx
htm_expand_builtin (tree exp, rtx target, bool * expandedp)
{
...
switch (nopnds)
{
case 0:
pat = GEN_FCN (icode) (NULL_RTX);
break;
case 1:
pat = GEN_FCN (icode) (op[0]);
break;
The 'case 0' looks suspicious. If the function behind the pointer
really is a zero-arg function this might or might not work depending on
the ABI. I'm not sure what the intention here is. I've compiled
gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c to see if it ever gets
into the 'case 0' but it doesn't.
The function 'htm_init_builtins' doesn't seem to handle a 'case 0'. I'm
confused, somebody else should have a look at this please.
Cheers,
Oleg
gcc/ChangeLog:
PR other/12081
config/rs6000/rs6000.c (gen_2arg_fn_t): Remove typedef.
(rs6000_emit_swdiv, rs6000_emit_swrsqrt): Don't cast result of
GEN_FCN to gen_2arg_fn_t.
[-- Attachment #2: rtx_dotdotdot_rs6000.patch --]
[-- Type: text/x-patch, Size: 1087 bytes --]
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 201512)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -284,9 +284,6 @@
{ "rsqrtd", (RECIP_DF_RSQRT | RECIP_V2DF_RSQRT) },
};
-/* 2 argument gen function typedef. */
-typedef rtx (*gen_2arg_fn_t) (rtx, rtx, rtx);
-
/* Pointer to function (in rs6000-c.c) that can define or undefine target
macros that have changed. Languages that don't support the preprocessor
don't link in rs6000-c.c, so we can't call it directly. */
@@ -28142,7 +28139,7 @@
passes++;
enum insn_code code = optab_handler (smul_optab, mode);
- gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
+ insn_gen_fn gen_mul = GEN_FCN (code);
gcc_assert (code != CODE_FOR_nothing);
@@ -28220,7 +28217,7 @@
int i;
rtx halfthree;
enum insn_code code = optab_handler (smul_optab, mode);
- gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code);
+ insn_gen_fn gen_mul = GEN_FCN (code);
gcc_assert (code != CODE_FOR_nothing);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [buildbot] r201513: Invalid cast
2013-08-06 21:21 ` Oleg Endo
@ 2013-08-06 23:14 ` Richard Henderson
0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2013-08-06 23:14 UTC (permalink / raw)
To: Oleg Endo; +Cc: Jan-Benedict Glaw, gcc-patches
On 08/06/2013 11:20 AM, Oleg Endo wrote:
> PR other/12081
> config/rs6000/rs6000.c (gen_2arg_fn_t): Remove typedef.
> (rs6000_emit_swdiv, rs6000_emit_swrsqrt): Don't cast result of
> GEN_FCN to gen_2arg_fn_t.
Ok.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-06 23:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20130805220945.22067.qmail@sourceware.org>
2013-08-06 11:27 ` [buildbot] r201513: Invalid cast Jan-Benedict Glaw
2013-08-06 21:21 ` Oleg Endo
2013-08-06 23:14 ` Richard Henderson
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).