[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2018-07-12 Thread rpirrera at aitek dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

--- Comment #14 from rpirrera at aitek dot it ---
(In reply to Richard Biener from comment #13)
> Can you please open a new bugreport?  Btw, your snippet doesn't compile
> because you miss ANSI_BOLD and friends, removing it and adding a #include
>  makes it compile fine (but not link, a main is missing).
> So in the new bugreport you open please provide a _complete_ testcase.

Opened a new bugreport here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86505.

Thank you.

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2018-07-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

Richard Biener  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Richard Biener  ---
Can you please open a new bugreport?  Btw, your snippet doesn't compile
because you miss ANSI_BOLD and friends, removing it and adding a #include
 makes it compile fine (but not link, a main is missing).
So in the new bugreport you open please provide a _complete_ testcase.

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2018-07-11 Thread rpirrera at aitek dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

rpirrera at aitek dot it changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #12 from rpirrera at aitek dot it ---
I have found another issue with __builtin_va_arg_pack_len() that happens when
the functions that uses __builtin_va_arg_pack() calls another function that
uses __builtin_va_arg_pack_len(), the argument len is miscalculated as you can
see in the attached example.
This was working in GCC version 4.4.7.


/*** TESTBUILTIN BEGIN /
static inline __attribute__(( __always_inline__)) int 
funA(unsigned int param, ...) 
{ 
return __builtin_va_arg_pack_len(); 
}

static inline __attribute__(( __always_inline__)) int
funB(unsigned int param, ...)
{ 
return funA(param,  2, 4, __builtin_va_arg_pack()); 
}

int 
testBuiltin(void) 
{ 
printf(ANSI_BOLD "%s" ANSI_RESET " ... ", __FUNCTION__);

int rc = funB(0,1,2); 
if (rc != 4) {
return 1;
}

return 0;
}

Thank you!

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-05-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||5.4.1
 Resolution|--- |FIXED
  Known to fail||5.4.0

--- Comment #11 from Richard Biener  ---
Fixed.

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-05-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

--- Comment #10 from Richard Biener  ---
Author: rguenth
Date: Wed May 10 07:53:45 2017
New Revision: 247827

URL: https://gcc.gnu.org/viewcvs?rev=247827=gcc=rev
Log:
2017-05-10  Richard Biener  

Backport from mainline
2017-03-21  Richard Biener  

PR tree-optimization/80122
* tree-inline.c (copy_bb): Do not expans va-arg packs or
va_arg_pack_len when the inlined call stmt requires pack
expansion itself.
* tree-inline.h (struct copy_body_data): Make call_stmt a gcall *.

* gcc.dg/torture/pr80122.c: New testcase.

2017-03-28  Richard Biener  

PR middle-end/80222
* gimple-fold.c (gimple_fold_indirect_ref): Do not touch
TYPE_REF_CAN_ALIAS_ALL references.
* fold-const.c (fold_indirect_ref_1): Likewise.

* g++.dg/pr80222.C: New testcase.

2017-04-06  Richard Biener  

PR tree-optimization/80334
* tree-ssa-loop-ivopts.c (rewrite_use_address): Properly
preserve alignment of accesses.

* g++.dg/torture/pr80334.C: New testcase.

2017-04-27  Richard Biener  

PR middle-end/80539
* tree-chrec.c (chrec_fold_plus_poly_poly): Deal with not
being in loop-closed SSA form conservatively.
(chrec_fold_multiply_poly_poly): Likewise.

* gcc.dg/torture/pr80539.c: New testcase.

Added:
branches/gcc-5-branch/gcc/testsuite/g++.dg/pr80222.C
branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr80334.C
branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr80122.c
branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr80539.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/fold-const.c
branches/gcc-5-branch/gcc/gimple-fold.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog
branches/gcc-5-branch/gcc/tree-chrec.c
branches/gcc-5-branch/gcc/tree-inline.c
branches/gcc-5-branch/gcc/tree-inline.h
branches/gcc-5-branch/gcc/tree-ssa-loop-ivopts.c

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-05-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

--- Comment #9 from Richard Biener  ---
Author: rguenth
Date: Wed May 10 07:44:41 2017
New Revision: 247826

URL: https://gcc.gnu.org/viewcvs?rev=247826=gcc=rev
Log:
2017-05-10  Richard Biener  

Backport from mainline
2017-03-17  Richard Biener  

PR middle-end/80075
* tree-eh.c (stmt_could_throw_1_p): Only handle gimple assigns.
Properly verify the LHS before the RHS possibly claims to be
handled.
(stmt_could_throw_p): Hande gimple conds fully here.  Clobbers
do not throw.

* g++.dg/torture/pr80075.C: New testcase.

2017-03-21  Brad Spengler 

PR plugin/80094
* plugin.c (htab_hash_plugin): New function.
(add_new_plugin): Use it and adjust.
(parse_plugin_arg_opt): Adjust.
(init_one_plugin): Likewise.

2017-03-20  Richard Biener  

PR tree-optimization/80113
* graphite-isl-ast-to-gimple.c (copy_loop_phi_nodes): Do not
allocate extra SSA name for PHI def.
(add_close_phis_to_outer_loops): Likewise.
(add_close_phis_to_merge_points): Likewise.
(copy_loop_close_phi_args): Likewise.
(copy_cond_phi_nodes): Likewise.

2017-03-21  Richard Biener  

PR tree-optimization/80122
* tree-inline.c (copy_bb): Do not expans va-arg packs or
va_arg_pack_len when the inlined call stmt requires pack
expansion itself.
* tree-inline.h (struct copy_body_data): Make call_stmt a gcall *.

* gcc.dg/torture/pr80122.c: New testcase.

2017-03-24  Richard Biener  

PR tree-optimization/80167
* graphite-isl-ast-to-gimple.c
(translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs
properly.
(translate_isl_ast_to_gimple::get_rename): Likewise.

* gcc.dg/graphite/pr80167.c: New testcase.

2017-03-27  Richard Biener  

PR tree-optimization/80170
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Make
sure DR/SCEV didnt fold in constants we do not see when looking
at the reference base alignment.

2017-03-27  Richard Biener  

PR middle-end/80171
* gimple-fold.c (fold_ctor_reference): Properly guard against
NULL return value from canonicalize_constructor_val.

* g++.dg/torture/pr80171.C: New testcase.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr80075.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr80171.C
branches/gcc-6-branch/gcc/testsuite/gcc.dg/graphite/pr80167.c
branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr80122.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/gimple-fold.c
branches/gcc-6-branch/gcc/graphite-isl-ast-to-gimple.c
branches/gcc-6-branch/gcc/plugin.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/tree-eh.c
branches/gcc-6-branch/gcc/tree-inline.c
branches/gcc-6-branch/gcc/tree-inline.h
branches/gcc-6-branch/gcc/tree-vect-data-refs.c

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-03-24 Thread rpirrera at aitek dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

--- Comment #8 from rpirrera at aitek dot it ---
OK we have applied the patch onto the 5.4.0 version of GCC and it is working
correctly.

Thank you for your support!

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-03-21 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

--- Comment #7 from rguenther at suse dot de  ---
On Tue, 21 Mar 2017, rpirrera at aitek dot it wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122
> 
> --- Comment #6 from rpirrera at aitek dot it ---
> How this work now?

It works by not replacing va_arg_pack/nargs when inlining a call
that itself uses va_arg_pack.

> We can expect a back port to versions 5.4 and 6.3 of this patch? Or this will
> exist only in the future version 7.x?

I plan to backport it if no issues show up (the patch should apply cleanly
to 6.3 at least so you can try yourself as well)

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-03-21 Thread rpirrera at aitek dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

--- Comment #6 from rpirrera at aitek dot it ---
How this work now?

We can expect a back port to versions 5.4 and 6.3 of this patch? Or this will
exist only in the future version 7.x?

Thank you!

[Bug tree-optimization/80122] __builtin_va_arg_pack() and __builtin_va_arg_pack_len() does not work correctly

2017-03-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80122

Richard Biener  changed:

   What|Removed |Added

  Component|c   |tree-optimization
  Known to work||7.0.1

--- Comment #5 from Richard Biener  ---
Fixed on trunk sofar.