public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/57756] New: Function target attribute is retaining  state of previously seen function
@ 2013-06-29  1:58 tmsriram at google dot com
  2013-10-15 21:43 ` [Bug target/57756] " tmsriram at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tmsriram at google dot com @ 2013-06-29  1:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

            Bug ID: 57756
           Summary: Function target attribute is retaining  state of
                    previously seen function
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tmsriram at google dot com

Simple repro:

foo.cc:
-------
__attribute__((always_inline,target("sse4.2")))
inline int callee ()
{
  return 0;
}

__attribute__((target("sse4.1")))
inline int caller ()
{
  return callee();
}

int main ()
{
  return caller();
}

$ g++ foo.cc

callee is inlined into caller.  This is incorrect, the callee's target ISA is
higher and GCC must complain.  Digging deeper, the x_ix86_isa_flags of both
caller and callee are the same.  The problem is in ix86_set_current_function in
i386.c where 

     else if (new_tree)
    {
      cl_target_option_restore (&global_options,
                    TREE_TARGET_OPTION (new_tree));
      target_reinit ();
    }

where the restore, restores the previous decl's target options to global.

It is not clear to me how to fix this.

Replace the target attributes in the above source with the equivalent #pragma
GCC push_options .... and the program will fail as expected.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
@ 2013-10-15 21:43 ` tmsriram at gcc dot gnu.org
  2013-10-16 11:25 ` graham.stott at btinternet dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tmsriram at gcc dot gnu.org @ 2013-10-15 21:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #1 from tmsriram at gcc dot gnu.org <tmsriram at gcc dot gnu.org> ---
Author: tmsriram
Date: Tue Oct 15 21:43:21 2013
New Revision: 203634

URL: http://gcc.gnu.org/viewcvs?rev=203634&root=gcc&view=rev
Log:
PR target/57756

The root-cause of this PR is that global_options is not restored to
default before calling ix86_valid_target_attribute_tree and hence
target attributes are incorrectly processed sometimes.

This patch refactors code in i386.c in functions in the call-chain of 
ix86_valid_target_attribute_tree to use any gcc_options struct passed
as a parameter. It replaces existing code which always uses the
global_options struct.

2013-10-15 Sriraman Tallam  <tmsriram@google.com>

    PR target/57756
    * optc-save-gen.awk: Add extra parameter to the save and restore
    target calls.
    * opth-gen.awk: Generate new TARGET_* macros  to accept a parameter.
    * tree.c (build_optimization_node): New parameter.  Add extra parameter
    to call to cl_optimization_save.
    (build_target_option_node): New parameter. Add extra parameter
    to call to cl_target_option_save.
    * tree.h (build_optimization_node): New parameter.
    (build_target_option_node): New parameter.
    * c-family/c-common.c (handle_optimize_attribute): Fix calls to
    build_optimization_node and build_target_option_node.
    * c-family/c-pragma.c (handle_pragma_optimize): Ditto.
    (handle_pragma_push_options): Ditto.
    * toplev.c (process_options): Ditto.
    * opts.c (init_options_struct): Check for opts_set non-null.
    * target.def (target_option.save): New parameter.
    (target_option.restore): New parameter.
    * tm.texi: Generate.
    * config/i386/i386-c.c (ix86_target_macros_internal): Ditto.
    (ix86_pragma_target_parse): Ditto.
    * config/i386/i386-protos.h (ix86_valid_target_attribute_tree): New
    parameters.
    * config/rs6000/rs6000.c (rs6000_option_override_internal): Fix calls
    to  build_optimization_node and build_target_option_node.
    (rs6000_valid_attribute_p): Ditto.
    (rs6000_pragma_target_parse): Ditto.
    * config/i386/i386.opt (x_ix86_target_flags_explicit): New TargetSave
    data.
    * config/i386/i386.h:
    TARGET_64BIT_P: New Macro
    TARGET_MMX_P: New Macro.
    TARGET_3DNOW_P: New Macro.
    TARGET_3DNOW_A_P: New Macro.
    TARGET_SSE_P: New Macro.
    TARGET_SSE2_P: New Macro.
    TARGET_SSE3_P: New Macro.
    TARGET_SSSE3_P: New Macro.
    TARGET_SSE4_1_P: New Macro.
    TARGET_SSE4_2_P: New Macro.
    TARGET_AVX_P: New Macro.
    TARGET_AVX2_P: New Macro.
    TARGET_AVX512F_P: New Macro.
    TARGET_AVX512PF_P: New Macro.
    TARGET_AVX512ER_P: New Macro.
    TARGET_AVX512CD_P: New Macro.
    TARGET_FMA_P: New Macro.
    TARGET_SSE4A_P: New Macro.
    TARGET_FMA4_P: New Macro.
    TARGET_XOP_P: New Macro.
    TARGET_LWP_P: New Macro.
    TARGET_ABM_P: New Macro.
    TARGET_BMI_P: New Macro.
    TARGET_BMI2_P: New Macro.
    TARGET_LZCNT_P: New Macro.
    TARGET_TBM_P: New Macro.
    TARGET_POPCNT_P: New Macro.
    TARGET_SAHF_P: New Macro.
    TARGET_MOVBE_P: New Macro.
    TARGET_CRC32_P: New Macro.
    TARGET_AES_P: New Macro.
    TARGET_PCLMUL_P: New Macro.
    TARGET_CMPXCHG16B_P: New Macro.
    TARGET_FSGSBASE_P: New Macro.
    TARGET_RDRND_P: New Macro.
    TARGET_F16C_P: New Macro.
    TARGET_RTM_P: New Macro.
    TARGET_HLE_P: New Macro.
    TARGET_RDSEED_P: New Macro.
    TARGET_PRFCHW_P: New Macro.
    TARGET_ADX_P: New Macro.
    TARGET_FXSR_P: New Macro.
    TARGET_XSAVE_P: New Macro.
    TARGET_XSAVEOPT_P: New Macro.
    TARGET_LP64_P: New Macro.
    TARGET_X32_P: New Macro.
    TARGET_FPMATH_DEFAULT_P: New Macro.
    TARGET_FLOAT_RETURNS_IN_80387_P: New Macro.
    * config/i386/i386.c (ix86_option_override_internal): New parameters.
    opts and opts_set.
    Change ix86_tune_string to access opts->x_ix86_tune_string.
    Change ix86_isa_flags to access opts->x_ix86_isa_flags.
    Change ix86_arch_string to access opts->x_ix86_arch_string.
    Change ix86_stringop_alg to access opts->x_ix86_stringop_alg.
    Change ix86_pmode to access opts->x_ix86_pmode.
    Change ix86_abi to access opts->x_ix86_abi.
    Change ix86_cmodel to access opts->x_ix86_cmodel.
    Change ix86_asm_dialect to access opts->x_ix86_asm_dialect.
    Change ix86_isa_flags_explicit to access
    opts->x_ix86_isa_flags_explicit.
    Change ix86_dump_tunes to access opts->x_ix86_dump_tunes.
    Change ix86_regparm to access opts->x_ix86_regparm.
    Change ix86_branch_cost to access opts->x_ix86_branch_cost.
    Change ix86_preferred_stack_boundary_arg to access
    opts->x_ix86_preferred_stack_boundary_arg.
    Change ix86_force_align_arg_pointer to access
    opts->x_ix86_force_align_arg_pointer.
    Change ix86_incoming_stack_boundar_arg to access
    opts->x_ix86_incoming_stack_boundar_arg.
    Change ix86_fpmath to access opts->x_ix86_fpmath.
    Change ix86_veclibabi_type to access opts->x_ix86_veclibabi_type.
    Change ix86_recip_name to access opts->x_ix86_recip_name.
    Change ix86_stack_protector_guard to access
    opts->x_ix86_stack_protector_guard.
    Change ix86_tune_memcpy_strategy to access
    opts->x_ix86_tune_memcpy_strategy.
    Change ix86_tune_memset_strategy to access
    opts->x_ix86_tune_memset_strategy.
    Change global_options to access opts.
    Change global_options_set to access opts_set.
        Change TARGET_64BIT to TARGET_64BIT_P (opts->...)
        Change TARGET_MMX to TARGET_MMX_P (opts->...)
        Change TARGET_3DNOW to TARGET_3DNOW_P (opts->...)
        Change TARGET_3DNOW_A to TARGET_3DNOW_A_P (opts->...)
        Change TARGET_SSE to TARGET_SSE_P (opts->...)
        Change TARGET_SSE2 to TARGET_SSE2_P (opts->...)
        Change TARGET_SSE3 to TARGET_SSE3_P (opts->...)
        Change TARGET_SSSE3 to TARGET_SSSE3_P (opts->...)
        Change TARGET_SSE4_1 to TARGET_SSE4_1_P (opts->...)
        Change TARGET_SSE4_2 to TARGET_SSE4_2_P (opts->...)
        Change TARGET_AVX to TARGET_AVX_P (opts->...)
        Change TARGET_AVX2 to TARGET_AVX2_P (opts->...)
        Change TARGET_AVX512F to TARGET_AVX512F_P (opts->...)
        Change TARGET_AVX512PF to TARGET_AVX512PF_P (opts->...)
        Change TARGET_AVX512ER to TARGET_AVX512ER_P (opts->...)
        Change TARGET_AVX512CD to TARGET_AVX512CD_P (opts->...)
        Change TARGET_FMA to TARGET_FMA_P (opts->...)
        Change TARGET_SSE4A to TARGET_SSE4A_P (opts->...)
        Change TARGET_FMA4 to TARGET_FMA4_P (opts->...)
        Change TARGET_XOP to TARGET_XOP_P (opts->...)
        Change TARGET_LWP to TARGET_LWP_P (opts->...)
        Change TARGET_ABM to TARGET_ABM_P (opts->...)
        Change TARGET_BMI to TARGET_BMI_P (opts->...)
        Change TARGET_BMI2 to TARGET_BMI2_P (opts->...)
        Change TARGET_LZCNT to TARGET_LZCNT_P (opts->...)
        Change TARGET_TBM to TARGET_TBM_P (opts->...)
        Change TARGET_POPCNT to TARGET_POPCNT_P (opts->...)
        Change TARGET_SAHF to TARGET_SAHF_P (opts->...)
        Change TARGET_MOVBE to TARGET_MOVBE_P (opts->...)
        Change TARGET_CRC32 to TARGET_CRC32_P (opts->...)
        Change TARGET_AES to TARGET_AES_P (opts->...)
        Change TARGET_PCLMUL to TARGET_PCLMUL_P (opts->...)
        Change TARGET_CMPXCHG16B to TARGET_CMPXCHG16B_P (opts->...)
        Change TARGET_FSGSBASE to TARGET_FSGSBASE_P (opts->...)
        Change TARGET_RDRND to TARGET_RDRND_P (opts->...)
        Change TARGET_F16C to TARGET_F16C_P (opts->...)
        Change TARGET_RTM to TARGET_RTM_P (opts->...)
        Change TARGET_HLE to TARGET_HLE_P (opts->...)
        Change TARGET_RDSEED to TARGET_RDSEED_P (opts->...)
        Change TARGET_PRFCHW to TARGET_PRFCHW_P (opts->...)
        Change TARGET_ADX to TARGET_ADX_P (opts->...)
        Change TARGET_FXSR to TARGET_FXSR_P (opts->...)
        Change TARGET_XSAVE to TARGET_XSAVE_P (opts->...)
        Change TARGET_XSAVEOPT to TARGET_XSAVEOPT_P (opts->...)
        Change TARGET_LP64 to TARGET_LP64_P (opts->...)
        Change TARGET_X32 to TARGET_X32_P (opts->...)
        Change TARGET_FPMATH_DEFAULT to TARGET_FPMATH_DEFAULT_P (opts->...)
        Change TARGET_FLOAT_RETURNS_IN_80387 to
     TARGET_FLOAT_RETURNS_IN_80387_P (opts->...)
    (ix86_function_specific_save): New parameter. Use opts-> fields
    to replace global fields.
    (ix86_function_specific_restore): Ditto.
    (ix86_valid_target_attribute_inner_p): New parameters.
    Fix recursive call.
    Fix call to ix86_handle_option and set_option.
    (ix86_valid_target_attribute_tree): New parameters.
    Change global_options to access opts.
    Change global_options_set to access opts_set.
    Fix call to ix86_valid_target_attribute_inner_p.
    Change ix86_tune_string to access opts->x_ix86_tune_string.
    Change ix86_arch_string to access opts->x_ix86_arch_string.
    Change ix86_fpmath to access opts->x_ix86_fpmath
    Fix call to ix86_option_override_internal.
    Fix call to ix86_add_new_builtins.
    Fix calls to build_optimization_node and build_target_option_node.
    (ix86_valid_target_attribute_p): Remove access to global_options.
    Use new gcc_options structure func_options.
    Fix call to ix86_valid_target_attribute_tree.
    Fix call to  build_optimization_node.
    (get_builtin_code_for_version):    Fix call to
    ix86_valid_target_attribute_tree.

    PR target/57756
    * gcc.target/i386/pr57756.c: New test.
    * gcc.target/i386/pr57756_2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr57756.c
    trunk/gcc/testsuite/gcc.target/i386/pr57756_2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-pragma.c
    trunk/gcc/config/i386/i386-c.c
    trunk/gcc/config/i386/i386-protos.h
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.h
    trunk/gcc/config/i386/i386.opt
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/doc/tm.texi
    trunk/gcc/optc-save-gen.awk
    trunk/gcc/opth-gen.awk
    trunk/gcc/opts.c
    trunk/gcc/target.def
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/toplev.c
    trunk/gcc/tree.c
    trunk/gcc/tree.h


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
  2013-10-15 21:43 ` [Bug target/57756] " tmsriram at gcc dot gnu.org
@ 2013-10-16 11:25 ` graham.stott at btinternet dot com
  2013-10-16 16:54 ` pthaugen at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: graham.stott at btinternet dot com @ 2013-10-16 11:25 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3034 bytes --]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #2 from graham.stott at btinternet dot com ---
All,

This patch broke MIPS builds. The opth-gen.awk 
changes deleted the #define for target_flags_explicit

Restoring the old #define does allow MIPS  to build again. I did check
if this will then break any other backend.
>From gcc-bugs-return-431920-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 16 11:25:33 2013
Return-Path: <gcc-bugs-return-431920-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7622 invoked by alias); 16 Oct 2013 11:25:33 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7582 invoked by uid 89); 16 Oct 2013 11:25:33 -0000
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 testsºYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: nm3-vm0.bt.bullet.mail.ird.yahoo.com
Received: from nm3-vm0.bt.bullet.mail.ird.yahoo.com (HELO nm3-vm0.bt.bullet.mail.ird.yahoo.com) (212.82.108.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 16 Oct 2013 11:25:32 +0000
Received: from [212.82.108.231] by nm3.bt.bullet.mail.ird.yahoo.com with NNFMP; 16 Oct 2013 11:25:28 -0000
Received: from [212.82.108.224] by tm4.bt.bullet.mail.ird.yahoo.com with NNFMP; 16 Oct 2013 11:25:28 -0000
Received: from [127.0.0.1] by omp1001.bt.mail.ird.yahoo.com with NNFMP; 16 Oct 2013 11:25:28 -0000
Received: (qmail 26265 invoked by uid 60001); 16 Oct 2013 11:25:28 -0000
Received: from [171.100.248.244] by web87401.mail.ir2.yahoo.com via HTTP; Wed, 16 Oct 2013 12:25:28 BST
References: <bug-57756-4@http.gcc.gnu.org/bugzilla/> <bug-57756-4-86yURTjNxi@http.gcc.gnu.org/bugzilla/>
Message-ID: <1381922728.7762.YahooMailNeo@web87401.mail.ir2.yahoo.com>
Date: Wed, 16 Oct 2013 11:25:00 -0000
From: Graham Stott <graham.stott@btinternet.com>
Reply-To: Graham Stott <graham.stott@btinternet.com>
Subject: Re: [Bug target/57756] Function target attribute is retaining  state of previously seen function
To: "tmsriram at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>,  "gcc-bugs@gcc.gnu.org" <gcc-bugs@gcc.gnu.org>
In-Reply-To: <bug-57756-4-86yURTjNxi@http.gcc.gnu.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-IsSubscribed: yes
X-SW-Source: 2013-10/txt/msg01064.txt.bz2
Content-length: 237

All,
 
This patch broke MIPS builds. The opth-gen.awk 
changes deleted the #define for target_flags_explicit

Restoring the old #define does allow MIPS  to build again. I did check
if this will then break any other backend.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
  2013-10-15 21:43 ` [Bug target/57756] " tmsriram at gcc dot gnu.org
  2013-10-16 11:25 ` graham.stott at btinternet dot com
@ 2013-10-16 16:54 ` pthaugen at gcc dot gnu.org
  2013-10-16 23:06 ` meissner at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2013-10-16 16:54 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5240 bytes --]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

Pat Haugen <pthaugen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pthaugen at gcc dot gnu.org

--- Comment #3 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
Revision 203634 broke PowerPC also with the following errors:

/home/pthaugen/src/gcc/trunk/gcc/gcc/config/rs6000/rs6000.c: At global scope:
/home/pthaugen/src/gcc/trunk/gcc/gcc/config/rs6000/rs6000.c:31122: error:
invalid conversion from ‘void (*)(cl_target_option*)’ to ‘void
(*)(cl_target_option*, gcc_options*)’
/home/pthaugen/src/gcc/trunk/gcc/gcc/config/rs6000/rs6000.c:31122: error:
invalid conversion from ‘void (*)(cl_target_option*)’ to ‘void
(*)(gcc_options*, cl_target_option*)’
>From gcc-bugs-return-431961-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 16 17:06:32 2013
Return-Path: <gcc-bugs-return-431961-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3784 invoked by alias); 16 Oct 2013 17:06:32 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3761 invoked by uid 48); 16 Oct 2013 17:06:29 -0000
From: "adam at aphirst dot karoo.co.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/58750] New: Allocate-on-assignment fails when using size(other_array) in the assignment statement
Date: Wed, 16 Oct 2013 17:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: adam at aphirst dot karoo.co.uk
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-58750-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01105.txt.bz2
Content-length: 2470

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX750

            Bug ID: 58750
           Summary: Allocate-on-assignment fails when using
                    size(other_array) in the assignment statement
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adam at aphirst dot karoo.co.uk

Created attachment 31019
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id1019&actioníit
The function to which I've isolated the problem

System: Arch Linux x86_64, GCC 4.8.1 20130725 (prerelease) from official repos
Compiler flags: -Wall -Wextra -stdò008 -s -march=native (no other
optimizations)

OK, so I have a function in which I'm putting some integers into allocatable
arrays using the F2008 allocate-on-assignment features. I've attached to this
bug report the specific function that goes sour, while the whole module file
can be found at http://pastebin.com/0ZVtVEzX , where the offending lines are
277-278.

I've been trying to construct a minimal demonstration of this problem without
much success, but I'll detail why I think this is a problem:

I'm allocating-on-assignment an array "primes" from the other functions in my
module, and if I print its contents or size(primes) I get the correct values.
So far so good.

What I'm then doing is creating an array full of zeros that's the same size as
"primes", called "powers". I'm doing this via:
powers = [ ( 0, i=1,size(primes) ) ]
and this is where the problem shows itself. If I then print powers I get a
blank line, and if I print size(powers) I get 0 . This of course causes the
rest of the function to be gibberish.

I also get the problem if I for instance have an integer "the_size" which I set
to size(primes). Despite being able to print "the_size" and get the correct
number, trying to allocate "powers" via
[ ( 0, i=1,the_size ) ]
gives the same problem.

If, however, I instead allocate "powers" using a literal, i.e.
powers = [ ( 0, i=1,10 ) ]
then the allocate-on-assign seems to work correctly.

Obviously I can also manually call allocate() then powers=0, but I shouldn't
_have_ to do that...

Is this enough information for someone to reproduce my problem, or understand
what the issue could be? Like I say, I've tried to create from-scratch
something to demonstrate the problem, but I can't coax the behaviour out.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
                   ` (2 preceding siblings ...)
  2013-10-16 16:54 ` pthaugen at gcc dot gnu.org
@ 2013-10-16 23:06 ` meissner at gcc dot gnu.org
  2013-11-14 13:19 ` ysrumyan at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: meissner at gcc dot gnu.org @ 2013-10-16 23:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #4 from Michael Meissner <meissner at gcc dot gnu.org> ---
Author: meissner
Date: Wed Oct 16 23:06:36 2013
New Revision: 203734

URL: http://gcc.gnu.org/viewcvs?rev=203734&root=gcc&view=rev
Log:
2013-10-16  Michael Meissner  <meissner@linux.vnet.ibm.com>

    PR target/57756
    * config/rs6000/rs6000.opt (rs6000_isa_flags_explicit): Move the
    explicit isa flag to be an options variable, instead of using
    global_options_set.  Remove define from rs6000.h.
    * config/rs6000/rs6000.h (rs6000_isa_flags_explicit): Likewise.

    * config/rs6000/rs6000.c (rs6000_option_override_internal):
    Initialize rs6000_isa_flags_explicit.
    (rs6000_function_specific_save): Add gcc_options* parameter, so
    that the powerpc builds after the 2013-10-15 changes.
    (rs6000_function_specific_restore): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/config/rs6000/rs6000.h
    trunk/gcc/config/rs6000/rs6000.opt


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
                   ` (3 preceding siblings ...)
  2013-10-16 23:06 ` meissner at gcc dot gnu.org
@ 2013-11-14 13:19 ` ysrumyan at gmail dot com
  2013-11-14 13:22 ` ysrumyan at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ysrumyan at gmail dot com @ 2013-11-14 13:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

Yuri Rumyantsev <ysrumyan at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ysrumyan at gmail dot com

--- Comment #6 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
After your fix we found out that compiler configured for x86 with fpmath=sse
does not use xmm registers and generates code correspondent to fpmath=i387 by
default. Our investigation has shown that (1) definition of
TARGET_FPMATH_DEFAULT_P macros was missed in config/i386/ssemath.h; (2) typo
has been found in i386.c (prefix opts->x_ was missed).

I attached the patch for it for which I checked that compiler built with
fpmath=sse geneerates desired sse code by default.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
                   ` (4 preceding siblings ...)
  2013-11-14 13:19 ` ysrumyan at gmail dot com
@ 2013-11-14 13:22 ` ysrumyan at gmail dot com
  2013-11-15  9:11 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ysrumyan at gmail dot com @ 2013-11-14 13:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #7 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
Created attachment 31217
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31217&action=edit
Additioanl patch for r203634.

See my comments.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
                   ` (5 preceding siblings ...)
  2013-11-14 13:22 ` ysrumyan at gmail dot com
@ 2013-11-15  9:11 ` ubizjak at gmail dot com
  2013-11-15 14:23 ` ysrumyan at gmail dot com
  2013-11-20 11:59 ` kyukhin at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2013-11-15  9:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Yuri Rumyantsev from comment #7)
> Created attachment 31217 [details]
> Additioanl patch for r203634.

--> gcc-patches@...
>From gcc-bugs-return-434670-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 15 09:16:32 2013
Return-Path: <gcc-bugs-return-434670-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22692 invoked by alias); 15 Nov 2013 09:16:31 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22657 invoked by uid 48); 15 Nov 2013 09:16:26 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59139] [4.7/4.8/4.9 Regression] internal compiler error: in get_val_for, at tree-ssa-loop-niter.c:2267
Date: Fri, 15 Nov 2013 09:16:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on component cf_known_to_work target_milestone short_desc everconfirmed cf_known_to_fail
Message-ID: <bug-59139-4-4J8w4tYdt8@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59139-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59139-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg01447.txt.bz2
Content-length: 1057

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY139

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-15
          Component|c                           |tree-optimization
      Known to work|                            |4.6.4
   Target Milestone|---                         |4.7.4
            Summary|internal compiler error: in |[4.7/4.8/4.9 Regression]
                   |get_val_for, at             |internal compiler error: in
                   |tree-ssa-loop-niter.c:2267  |get_val_for, at
                   |                            |tree-ssa-loop-niter.c:2267
     Ever confirmed|0                           |1
      Known to fail|                            |4.7.3, 4.8.2, 4.9.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

(gdb) call debug_gimple_stmt (stmt)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
                   ` (6 preceding siblings ...)
  2013-11-15  9:11 ` ubizjak at gmail dot com
@ 2013-11-15 14:23 ` ysrumyan at gmail dot com
  2013-11-20 11:59 ` kyukhin at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ysrumyan at gmail dot com @ 2013-11-15 14:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #9 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
Hi Uros,

I decided that the bug owner should fix it and send my patch (or
modified one) for review to GCC community, i.e. I was not planning to
fix it. But if I should do it pls let me know and I send it to
gcc-patches@...

Best regards.
Yuri.

2013/11/15 ubizjak at gmail dot com <gcc-bugzilla@gcc.gnu.org>:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756
>
> --- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
> (In reply to Yuri Rumyantsev from comment #7)
>> Created attachment 31217 [details]
>> Additioanl patch for r203634.
>
> --> gcc-patches@...
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>From gcc-bugs-return-434698-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 15 14:37:02 2013
Return-Path: <gcc-bugs-return-434698-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32183 invoked by alias); 15 Nov 2013 14:37:01 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 32136 invoked by uid 48); 15 Nov 2013 14:36:58 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/59147] 128-bit division error
Date: Fri, 15 Nov 2013 14:37:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.6.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59147-4-lEWaGx6NOC@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59147-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59147-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg01475.txt.bz2
Content-length: 295

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY147

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
It works for me on powerpc-apple-darwin9 (with -m64), x86_64-apple-darwin10,
and x86_64-apple-darwin13. It looks like a bug in the 128-bit library of
x86_64-w64-mingw32.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57756] Function target attribute is retaining  state of previously seen function
  2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
                   ` (7 preceding siblings ...)
  2013-11-15 14:23 ` ysrumyan at gmail dot com
@ 2013-11-20 11:59 ` kyukhin at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kyukhin at gcc dot gnu.org @ 2013-11-20 11:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57756

--- Comment #10 from Kirill Yukhin <kyukhin at gcc dot gnu.org> ---
Author: kyukhin
Date: Wed Nov 20 11:59:05 2013
New Revision: 205104

URL: http://gcc.gnu.org/viewcvs?rev=205104&root=gcc&view=rev
Log:
PR target/57756
* config/i386/i386.c (ix86_option_override_internal): Add missed
argument prefix for 'ix86_fpmath'.
* config/i386/ssemath.h: Add missed definition of
TARGET_FPMATH_DEFAULT_P macros.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/ssemath.h


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-11-20 11:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-29  1:58 [Bug target/57756] New: Function target attribute is retaining state of previously seen function tmsriram at google dot com
2013-10-15 21:43 ` [Bug target/57756] " tmsriram at gcc dot gnu.org
2013-10-16 11:25 ` graham.stott at btinternet dot com
2013-10-16 16:54 ` pthaugen at gcc dot gnu.org
2013-10-16 23:06 ` meissner at gcc dot gnu.org
2013-11-14 13:19 ` ysrumyan at gmail dot com
2013-11-14 13:22 ` ysrumyan at gmail dot com
2013-11-15  9:11 ` ubizjak at gmail dot com
2013-11-15 14:23 ` ysrumyan at gmail dot com
2013-11-20 11:59 ` kyukhin 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).