public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47438] New: function arguments memory alignment problem.
@ 2011-01-24 17:10 dbms007 at hanmail dot net
  2011-01-24 17:25 ` [Bug c/47438] " dbms007 at hanmail dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dbms007 at hanmail dot net @ 2011-01-24 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: function arguments memory alignment problem.
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dbms007@hanmail.net


parameter memory aligment problem in 64 bit gcc compiler.

example ) 

int Test1(tranNo, name, path, sSpId, spId, spPg, type, size, parm)
long tranNo;
char* name, *path;
short sSpid, spId, spPg, type;
long size;
char* parm;
{
    printf("----------- size : %ld\n", size);
}

int Test2(tranNo, name, path, sSpId, spId, spPg, size, type, parm)
long tranNo;
char* name, *path;
short sSpid, spId, spPg;
long size;
short type;
char* parm;
{
    printf("----------- size : %ld\n", size);
}

main()
{
    int xx = 7974288;
    Test1(xx);
    Test2(xx);
}


compiler option 
gcc -O -m64 test.c

Above program u can see the different result output .
i think that some of passing parament causes memory alignment problem..

I like to know which version can solve that problem ?
please answer me asap ..


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

* [Bug c/47438] function arguments memory alignment problem.
  2011-01-24 17:10 [Bug c/47438] New: function arguments memory alignment problem dbms007 at hanmail dot net
@ 2011-01-24 17:25 ` dbms007 at hanmail dot net
  2011-01-24 21:37 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dbms007 at hanmail dot net @ 2011-01-24 17:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from doh-hyun koh <dbms007 at hanmail dot net> 2011-01-24 17:02:45 UTC ---
hi I am developing big application with old large source in linux ..
even though I could manage some of bug, eventually the will be big troubles..
so I here I like to report the bugs and wait for your answer .. 
Please answer me asap ..


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

* [Bug c/47438] function arguments memory alignment problem.
  2011-01-24 17:10 [Bug c/47438] New: function arguments memory alignment problem dbms007 at hanmail dot net
  2011-01-24 17:25 ` [Bug c/47438] " dbms007 at hanmail dot net
@ 2011-01-24 21:37 ` pinskia at gcc dot gnu.org
  2011-01-25 11:07 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-01-24 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-01-24 21:21:57 UTC ---
You are invoking undefined behavior here.
I cannot get your example to compile:
t.c: In function ‘Test1’:
t.c:4: error: declaration for parameter ‘sSpid’ but no such parameter
t.c:8: warning: incompatible implicit declaration of built-in function ‘printf’
t.c: In function ‘Test2’:
t.c:14: error: declaration for parameter ‘sSpid’ but no such parameter
t.c:19: warning: incompatible implicit declaration of built-in function
‘printf’


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

* [Bug c/47438] function arguments memory alignment problem.
  2011-01-24 17:10 [Bug c/47438] New: function arguments memory alignment problem dbms007 at hanmail dot net
  2011-01-24 17:25 ` [Bug c/47438] " dbms007 at hanmail dot net
  2011-01-24 21:37 ` pinskia at gcc dot gnu.org
@ 2011-01-25 11:07 ` rguenth at gcc dot gnu.org
  2011-01-25 12:02 ` dbms007 at hanmail dot net
  2011-02-02  3:25 ` hp at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-25 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-25 10:50:00 UTC ---
And you are using a parameter that was not initialized (passed).


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

* [Bug c/47438] function arguments memory alignment problem.
  2011-01-24 17:10 [Bug c/47438] New: function arguments memory alignment problem dbms007 at hanmail dot net
                   ` (2 preceding siblings ...)
  2011-01-25 11:07 ` rguenth at gcc dot gnu.org
@ 2011-01-25 12:02 ` dbms007 at hanmail dot net
  2011-02-02  3:25 ` hp at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dbms007 at hanmail dot net @ 2011-01-25 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from doh-hyun koh <dbms007 at hanmail dot net> 2011-01-25 11:28:51 UTC ---
#include <stdio.h>

int Test1(tranNo, name, path, sSpId, spId, spPg, type, size, parm)
long tranNo;
char* name, *path;
short sSpId, spId, spPg, type;
long size;
char* parm;
{
    printf("----------- size : %ld\n", size);
}


int Test2(tranNo, name, path, sSpId, spId, spPg, size, type, parm)
long tranNo;
char* name, *path;
short sSpId, spId, spPg;
long size;
short type;
char* parm;
{
    printf("----------- size : %ld\n", size);
}

main()
{
    int xx = 7974288;
    Test1(xx);
    Test2(xx);
}


compiler option 
gcc -O -m64 test.c

Would u please try again ?


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

* [Bug c/47438] function arguments memory alignment problem.
  2011-01-24 17:10 [Bug c/47438] New: function arguments memory alignment problem dbms007 at hanmail dot net
                   ` (3 preceding siblings ...)
  2011-01-25 12:02 ` dbms007 at hanmail dot net
@ 2011-02-02  3:25 ` hp at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hp at gcc dot gnu.org @ 2011-02-02  3:25 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

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

--- Comment #5 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2011-02-02 03:25:44 UTC ---
(In reply to comment #4)
> Would u please try again ?

I tried on my aging Fedora 12 installation (gcc-4.4.3-something) and somewhat
surprisingly the code compiled (outputting different numbers as expected), but
you'll see sufficient warnings with the options "-W -Wall" to put you on track.

You can't expect calls to different functions (different parameter types) to
behave the same like that, certainly not when passing the wrong number of
parameters as well as using parameters that "wasn't passed"!  An undefined
value is used, which is about as undefined as the one in the other function,
just not read as the same value.  Really, you can't even expect tranNo (the
first and single parameter actually passed) to be read as the same value when
you call functions that way (or any undefined way).
If you want to report a bug related to alignment of passed parameters, would
you please try again?  Start with real code from your application, make sure it
compiles without related warnings, open a new but report.


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

end of thread, other threads:[~2011-02-02  3:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24 17:10 [Bug c/47438] New: function arguments memory alignment problem dbms007 at hanmail dot net
2011-01-24 17:25 ` [Bug c/47438] " dbms007 at hanmail dot net
2011-01-24 21:37 ` pinskia at gcc dot gnu.org
2011-01-25 11:07 ` rguenth at gcc dot gnu.org
2011-01-25 12:02 ` dbms007 at hanmail dot net
2011-02-02  3:25 ` hp 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).