This is the mail archive of the gcc-patches@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]

[PATCH] Fix PR/23125, global register variables without asmspec


The problem here is that the middle-end does not error out if a
global register variable does not have an asmspec.  Also we use
the variable name as the register name which is totally wrong.
The front-ends use change_decl_assembler_name for global register
variables which is wrong as we don't know if it was the asmspec
or the variable name.  This patch changes the front-end to
always use set_user_assembler_name for global register variables.
It also changes the middle-end to error out correctly for variables
which don't have asmspec.


OK? Bootstrapped and tested on x86_64-pc-linux-gnu with no regressions.


Thanks,
Andrew Pinski


ChangeLog: * c-decl.c (finish_decl): Use set_user_assembler_name even for register variables. * varasm.c (make_decl_rtl): If a register variable does not have a set user assmbler name, error out. Decode the asmspec is now name+1 bypassing '*'.

cp/ChangeLog:
	* decl.c (make_rtl_for_nonlocal_decl): Use set_user_assembler_name
	instead of change_decl_assembler_name.



Testcase:

/* { dg-options "" } */
/* { dg-do compile } */
register int r0; /* { dg-error "register name not specified" } */
register int bp; /* { dg-error "register name not specified" } */
register int sp; /* { dg-error "register name not specified" } */
register int r30; /* { dg-error "register name not specified" } */
register int toc; /* { dg-error "register name not specified" } */
register int d0; /* { dg-error "register name not specified" } */
register int a0; /* { dg-error "register name not specified" } */

Attachment: t76564.diff.txt
Description: Text document


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