This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/55646] New: Array of data as argument


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]