public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55646] New: Array of data as argument
@ 2012-12-11 14:03 bratsinot at gmail dot com
2012-12-11 14:07 ` [Bug c/55646] " bratsinot at gmail dot com
2015-01-20 10:32 ` mpolacek at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: bratsinot at gmail dot com @ 2012-12-11 14:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55646
Bug #: 55646
Summary: Array of data as argument
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bratsinot@gmail.com
If wrote this:
> fwrite("\xAA\xBB\xCC\x0A", 1, 4, stdout);
gcc put in .data/.text section one piece of data, something like that:
> .string "\252\273\314\n"
But if wrote this:
> fwrite((uint8_t[]){0xAA,0xBB,0xCC,0x0A}, 1, 4, stdout);
gcc will put the data bit by bit in stack, something like that:
> movb $-86, (%rsp)
> movb $-69, 1(%rsp)
> movb $-52, 2(%rsp)
> movb $10, 3(%rsp)
P.S. Build with -O3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/55646] Array of data as argument
2012-12-11 14:03 [Bug c/55646] New: Array of data as argument bratsinot at gmail dot com
@ 2012-12-11 14:07 ` bratsinot at gmail dot com
2015-01-20 10:32 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: bratsinot at gmail dot com @ 2012-12-11 14:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55646
--- Comment #1 from Alexander <bratsinot at gmail dot com> 2012-12-11 14:07:21 UTC ---
If write this:
> static const uint8_t qwe[] = {0xAA,0xBB,0xCC,0x0A};
> fwrite(qwe, 1, 4, stdout);
gcc put data in one piece, something like that:
> qwe.2230:
> .byte -86
> .byte -69
> .byte -52
> .byte 10
P.S.S. Sorry for my mistakes, English not my native language.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/55646] Array of data as argument
2012-12-11 14:03 [Bug c/55646] New: Array of data as argument bratsinot at gmail dot com
2012-12-11 14:07 ` [Bug c/55646] " bratsinot at gmail dot com
@ 2015-01-20 10:32 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-20 10:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55646
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Doesn't look like a bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-20 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-11 14:03 [Bug c/55646] New: Array of data as argument bratsinot at gmail dot com
2012-12-11 14:07 ` [Bug c/55646] " bratsinot at gmail dot com
2015-01-20 10:32 ` mpolacek 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).