[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2016-07-10 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

Andrew Pinski  changed:

   What|Removed |Added

   Severity|blocker |normal

[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2015-10-30 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

--- Comment #6 from rguenther at suse dot de  ---
On Fri, 30 Oct 2015, ranjan.amit8 at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028
> 
> --- Comment #5 from martin  ---
> Hi Richard,
> 
> There are the changes came after gcc-4.9.3 because of that I am getting above
> issue, but if I comment these 2 line in file (tree-streamer-in.c &
> tree-streamer-out.c) then it resolves the issue I am facing in gcc-5.2.0.
> 
> Because of these changes,  the gcc-5.2.0 fails but gcc-4.9.3 sources are
> working fine.
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=73527b1dbb74fb8a2fcb92627292c1c0334c8364
>
> 
> Index: 
> ===
> --- a/gcc/tree-streamer-in.c2015-03-27 12:28:59.0 +0530
> +++ b/gcc/tree-streamer-in.c2015-10-23 03:09:08.758332929 +0530
> @@ -802,7 +802,7 @@ lto_input_ts_function_decl_tree_pointers
>/* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body.  */
>DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in);
>  #ifndef ACCEL_COMPILER
> -  DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);
> +/*  DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);*/
>  #endif
>DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, 
> data_in);
> 
> 
> ===
> --- a/gcc/tree-streamer-out.c   2015-02-26 17:56:11.0 +0530
> +++ b/gcc/tree-streamer-out.c   2015-10-23 03:09:13.542332646 +0530
> @@ -708,7 +708,7 @@ write_ts_function_decl_tree_pointers (st
>stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p);
>/* Don't stream these when passing things to a different target.  */
>if (!lto_stream_offload_p)
> -stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);
> +  /*  stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);*/
>stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr), ref_p);
>  }

Yes, those are used to implement the feature I was talking about.

But the issue lies somewhere in the rs6000 backend and thus needs
deeper investigation by one of its maintainers.


[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2015-10-29 Thread ranjan.amit8 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

--- Comment #5 from martin  ---
Hi Richard,

There are the changes came after gcc-4.9.3 because of that I am getting above
issue, but if I comment these 2 line in file (tree-streamer-in.c &
tree-streamer-out.c) then it resolves the issue I am facing in gcc-5.2.0.

Because of these changes,  the gcc-5.2.0 fails but gcc-4.9.3 sources are
working fine.
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=73527b1dbb74fb8a2fcb92627292c1c0334c8364


Index: 
===
--- a/gcc/tree-streamer-in.c2015-03-27 12:28:59.0 +0530
+++ b/gcc/tree-streamer-in.c2015-10-23 03:09:08.758332929 +0530
@@ -802,7 +802,7 @@ lto_input_ts_function_decl_tree_pointers
   /* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body.  */
   DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in);
 #ifndef ACCEL_COMPILER
-  DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);
+/*  DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);*/
 #endif
   DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, data_in);


===
--- a/gcc/tree-streamer-out.c   2015-02-26 17:56:11.0 +0530
+++ b/gcc/tree-streamer-out.c   2015-10-23 03:09:13.542332646 +0530
@@ -708,7 +708,7 @@ write_ts_function_decl_tree_pointers (st
   stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p);
   /* Don't stream these when passing things to a different target.  */
   if (!lto_stream_offload_p)
-stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);
+  /*  stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);*/
   stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr), ref_p);
 }



Thanks,
Martin


[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2015-10-21 Thread ranjan.amit8 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

--- Comment #4 from martin  ---
$ ./powerpc-pc-linux-gcc test.c -mcpu=e6500

does that work? (without LTO?)

Yes, It works without -flto.


[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2015-10-21 Thread ranjan.amit8 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

--- Comment #2 from martin  ---
Hi Richard,

 You mean to say that there is no issue with LTO, the error is only due to
addition flags for particular -mcpu.

I am only getting this issue when I passs -flto option with -mcpu=e6500.
Without -flto there is no issue as

 $ ./powerpc-windriver-linux-gcc test.c -mcpu=e6500

It means with particular -mcpu with -flto option switches additional flags
which is resulting in this error during compilation. While those additional
flags came into picture after gcc-5.1.0 release.

$ ./powerpc-windriver-linux-gcc test.c -mcpu=e6500 -flto
In function âmainâ:
lto1: warning: compilation : main_target_opt = 1
lto1: error: target attribute or pragma changes single precision floating point
lto1: error: target attribute or pragma changes double precision floating point
lto-wrapper: fatal error: ./powerpc-windriver-linux-gcc returned 1 exit status
compilation terminated.
/opt/2cross/lib/gcc/powerpc-windriver-linux/5.2.0/../../../../powerpc-windriver-linux/bin/ld:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Can you guide me further.

Thanks,
Martin

[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2015-10-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener  ---
I was saying that LTO now makes it appear like it uses target attributes to
change this kind of property and this is because the rs6000.opt file tells
it that it can do this.  But then when it does things fail.

I think the code still passes on -mcpu=e6500 to the link stage thus you
get

int __attribute__((target("cpu=e6500"))) main()
{
}

compiled by

$ ./powerpc-pc-linux-gcc test.c -mcpu=e6500

does that work? (without LTO?)


Note I have in my local tree

Index: gcc/lto-opts.c
===
--- gcc/lto-opts.c  (revision 229119)
+++ gcc/lto-opts.c  (working copy)
@@ -201,6 +201,12 @@ lto_write_options (void)
  && lto_stream_offload_p)
continue;

+  /* Do not store target-specific options if we target a
+ SWITCHABLE_TARGET target.  */
+  if ((cl_options[option->opt_index].flags & CL_TARGET)
+ && SWITCHABLE_TARGET)
+   continue;
+
   /* Drop options created from the gcc driver that will be rejected
 when passed on to the driver again.  */
   if (cl_options[option->opt_index].cl_reject_driver)

which would stop us from passing the target options seen at compile-time
as the "default global state" to the link command.


[Bug target/68028] Compilation error "lto1: error: target attribute or pragma changes single precision floating point", with "-flto" on different variant of powerpc like -mcpu=e6500, 8540, 8548, e500m

2015-10-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028

Richard Biener  changed:

   What|Removed |Added

   Keywords||lto
 CC||hubicka at gcc dot gnu.org
  Component|lto |target

--- Comment #1 from Richard Biener  ---
static bool
rs6000_option_override_internal (bool global_init_p)
{
...
  if (main_target_opt)
{
  if (main_target_opt->x_rs6000_single_float != rs6000_single_float)
error ("target attribute or pragma changes single precision floating "
   "point");
  if (main_target_opt->x_rs6000_double_float != rs6000_double_float)
error ("target attribute or pragma changes double precision floating "
   "point");
}


it looks like -mcpu=... is not allowed to differ from global defaults.  Note
that LTO now passes all "Save" options in function attributes and no longer
passes along -mcpu= to the link-time transparently.

mcpu=
Target RejectNegative Joined Var(rs6000_cpu_index) Init(-1)
Enum(rs6000_cpu_opt_value) Save
-mcpu=  Use features of and schedule code for given CPU

so -mcpu= is 'Save' but appearantly switches additional flags?