public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/55970] New: [x86] Avoid reverse order of function argument gimplifying
@ 2013-01-14 14:44 ysrumyan at gmail dot com
  2013-01-14 14:47 ` [Bug tree-optimization/55970] " ysrumyan at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ysrumyan at gmail dot com @ 2013-01-14 14:44 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55970
           Summary: [x86] Avoid reverse order of function argument
                    gimplifying
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ysrumyan@gmail.com


One important customer met with this problem in a process of porting app from
ARN to IA. The issue can be illustrated by attached example and essential for
x86 platform since only it defines 'PUSH_ARGS_REVERSED' macros. Note also that
attached code is not compliant with C99 standard since it assume definite order
of argument calculation.

gcc -O3 t.c t_main.c
./a.out
Test Failed
gcc -O3 t.c t_main_fix.c              
./a.out 
Test Passed

diff t_main.c t_main_fix.c
13c13,14
<   if (foo (foo1(), foo1()))
---
>   int x1 = foo1(), x2 = foo1();
>   if (foo (x1, x2))

You can see that gimplifying of function arguments (gimplify.c,
dimplify_call_expr) uses reverse order of arguments:

  /* Finally, gimplify the function arguments.  */
  if (nargs > 0)
    {
      for (i = (PUSH_ARGS_REVERSED ? nargs - 1 : 0);
           PUSH_ARGS_REVERSED ? i >= 0 : i < nargs;
           PUSH_ARGS_REVERSED ? i-- : i++)
        {
...

I assume that we must no use reverse order in this place, i.e. loop header must
look like
      for (i = 0; i < nargs; i++)


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

end of thread, other threads:[~2013-02-04 11:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 14:44 [Bug tree-optimization/55970] New: [x86] Avoid reverse order of function argument gimplifying ysrumyan at gmail dot com
2013-01-14 14:47 ` [Bug tree-optimization/55970] " ysrumyan at gmail dot com
2013-01-14 14:56 ` rguenth at gcc dot gnu.org
2013-01-14 15:16 ` ysrumyan at gmail dot com
2013-01-14 17:34 ` pinskia at gcc dot gnu.org
2013-02-01 13:34 ` ysrumyan at gmail dot com
2013-02-04 11:15 ` manu 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).