public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
@ 2003-09-08 15:01 waspcoder at mail dot ru
  2003-09-08 15:03 ` [Bug middle-end/12210] " waspcoder at mail dot ru
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: waspcoder at mail dot ru @ 2003-09-08 15:01 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Bug in `expand_builtin_apply'(possibly in
                    `allocate_dynamic_stack_space')
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: waspcoder at mail dot ru
                CC: gcc-bugs at gcc dot gnu dot org

BUGREPORT
 Ossadchy Yury A., waspcoder@mail.ru
 GCC 3.3.1 fails on test
--- CODE ---
#include <stdio.h>

__attribute__ ((regparm (0))) int fn1 (int arg1, int arg2)
{
    printf ("fn1 (%i, %i)\n", arg1, arg2);
    return -20;
}

__attribute__ ((regparm (0))) int caller (int arg1, int arg2)
{
    void * args = __builtin_apply_args ();

    printf ("caller (%i, %i)\n", arg1, arg2);
    __builtin_return (__builtin_apply ((void (*)())&fn1, args, sizeof (int)*2));
							    // ^^^^^^^^^^^^^^
							    // it's bad, but it must work!
							    // regparm (0)!
}

int main ()
{
    printf ("result == %i\n", caller (10, 34));
}
--- /CODE ---

gcc-2.96:
>caller (10, 34)
>fn1 (10, 34)
>result == -20
    
gcc-3.3.1:
>caller (10, 34)
>fn1 (1074217344, 1075033152)
>result == -20

gcc -v:
>Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
>Configured with: ../gcc-3.3.1/configure --enable-languages=c objc++
>Thread model: posix
>gcc version 3.3.1

NOTE: include somewhat like my test into `testsuite'!

Problem is in `builtins.c::expand_builtin_apply', when pushing parameters.
Simplest `bugfix':
  /* WASP: dest = allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT);
           does NOT works, use this:  */
  dest = push_block (argsize, 0, 1);


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
@ 2003-09-08 15:03 ` waspcoder at mail dot ru
  2003-09-08 15:07 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: waspcoder at mail dot ru @ 2003-09-08 15:03 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From waspcoder at mail dot ru  2003-09-08 15:03 -------
 BUGREPORT
 Ossadchy Yury A., waspcoder@mail.ru
 GCC 3.3.1 fails on test
--- CODE ---
#include <stdio.h>

__attribute__ ((regparm (0))) int fn1 (int arg1, int arg2)
{
    printf ("fn1 (%i, %i)\n", arg1, arg2);
    return -20;
}

__attribute__ ((regparm (0))) int caller (int arg1, int arg2)
{
    void * args = __builtin_apply_args ();

    printf ("caller (%i, %i)\n", arg1, arg2);
    __builtin_return (__builtin_apply ((void (*)())&fn1, args, sizeof (int)*2));
							    // ^^^^^^^^^^^^^^
							    // it's bad, but it must work!
							    // regparm (0)!
}

int main ()
{
    printf ("result == %i\n", caller (10, 34));
}
--- /CODE ---

gcc-2.96:
>caller (10, 34)
>fn1 (10, 34)
>result == -20
    
gcc-3.3.1:
>caller (10, 34)
>fn1 (1074217344, 1075033152)
>result == -20

gcc -v:
>Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
>Configured with: ../gcc-3.3.1/configure --enable-languages=c objc++
>Thread model: posix
>gcc version 3.3.1

NOTE: include somewhat like my test into `testsuite'!

Problem is in `builtins.c::expand_builtin_apply', when pushing parameters.
Simplest `bugfix':
  /* WASP: dest = allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT);
           does NOT works, use this:  */
  dest = push_block (argsize, 0, 1);


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
  2003-09-08 15:03 ` [Bug middle-end/12210] " waspcoder at mail dot ru
@ 2003-09-08 15:07 ` pinskia at gcc dot gnu dot org
  2003-11-24  6:16 ` ebotcazou at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-08 15:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-08 15:07 -------
I want to say this is the same bug as PR 9890 but I do not know.


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
  2003-09-08 15:03 ` [Bug middle-end/12210] " waspcoder at mail dot ru
  2003-09-08 15:07 ` pinskia at gcc dot gnu dot org
@ 2003-11-24  6:16 ` ebotcazou at gcc dot gnu dot org
  2003-11-24  6:17 ` ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-11-24  6:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-11-24 06:16 -------
__builtin_apply is indeed broken.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-24 06:16:48
               date|                            |


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


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
                   ` (2 preceding siblings ...)
  2003-11-24  6:16 ` ebotcazou at gcc dot gnu dot org
@ 2003-11-24  6:17 ` ebotcazou at gcc dot gnu dot org
  2003-11-24  6:28 ` [Bug middle-end/12210] Bug in `expand_builtin_apply' ebotcazou at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-11-24  6:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-11-24 06:17 -------
I'm already in this business :-)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
                   ` (3 preceding siblings ...)
  2003-11-24  6:17 ` ebotcazou at gcc dot gnu dot org
@ 2003-11-24  6:28 ` ebotcazou at gcc dot gnu dot org
  2003-11-25 18:51 ` ebotcazou at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-11-24  6:28 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|                            |i686-pc-linux-gnu
   GCC host triplet|                            |i686-pc-linux-gnu
 GCC target triplet|                            |i686-pc-linux-gnu
            Summary|Bug in                      |Bug in
                   |`expand_builtin_apply'(possi|`expand_builtin_apply'
                   |bly in                      |
                   |`allocate_dynamic_stack_spac|
                   |e')                         |
   Target Milestone|---                         |3.4


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


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
                   ` (4 preceding siblings ...)
  2003-11-24  6:28 ` [Bug middle-end/12210] Bug in `expand_builtin_apply' ebotcazou at gcc dot gnu dot org
@ 2003-11-25 18:51 ` ebotcazou at gcc dot gnu dot org
  2003-11-27  6:24 ` ebotcazou at gcc dot gnu dot org
  2003-12-31 18:10 ` ebotcazou at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-11-25 18:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-11-25 18:51 -------
I don't think the fix is right, since push_block statically allocates memory on
the stack while we really want to dynamically allocate in this case.


-- 


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


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
                   ` (5 preceding siblings ...)
  2003-11-25 18:51 ` ebotcazou at gcc dot gnu dot org
@ 2003-11-27  6:24 ` ebotcazou at gcc dot gnu dot org
  2003-12-31 18:10 ` ebotcazou at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-11-27  6:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-11-27 06:24 -------
See http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00897.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug middle-end/12210] Bug in `expand_builtin_apply'
  2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
                   ` (6 preceding siblings ...)
  2003-11-27  6:24 ` ebotcazou at gcc dot gnu dot org
@ 2003-12-31 18:10 ` ebotcazou at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2003-12-31 18:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-12-31 18:04 -------
*** Bug 13531 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lowzl at hotmail dot com


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


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

end of thread, other threads:[~2003-12-31 18:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 15:01 [Bug middle-end/12210] New: Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space') waspcoder at mail dot ru
2003-09-08 15:03 ` [Bug middle-end/12210] " waspcoder at mail dot ru
2003-09-08 15:07 ` pinskia at gcc dot gnu dot org
2003-11-24  6:16 ` ebotcazou at gcc dot gnu dot org
2003-11-24  6:17 ` ebotcazou at gcc dot gnu dot org
2003-11-24  6:28 ` [Bug middle-end/12210] Bug in `expand_builtin_apply' ebotcazou at gcc dot gnu dot org
2003-11-25 18:51 ` ebotcazou at gcc dot gnu dot org
2003-11-27  6:24 ` ebotcazou at gcc dot gnu dot org
2003-12-31 18:10 ` ebotcazou at gcc dot gnu dot 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).