Skip to content

0x22 in unsigned char arrays  #50

@smf-

Description

@smf-

putting 0x22 into an unsigned char array is causing me a problem

compiling this with -S

static unsigned char works[] = {0x01, 0x02, 0x03};
static unsigned char fails[] = {0x21, 0x22, 0x23};

volatile unsigned char *o = (volatile unsigned char *)0;

int main(int argc, char *argv[])
{
	for (int i = 0; i < 3; i++)
	{
		*o = works[i];
		*o = fails[i];
	}
}

gives:

	section	.data,"aw",@progbits
	private	_works
_works:
	db	"���"

	section	.data,"aw",@progbits
	private	_fails
_fails:
	db	"!""#"

Which I think might be malformed.

Using the x64 version of clang gives something more like I would expect, but I'm not sure if the output is what you expect and there is an issue elsewhere?

works:                                  # @works
	.ascii	"\001\002\003"

fails:                                  # @fails
	.ascii	"!\"#"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions