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]

Re: [PATCH] Fix ICE on invalid ix86 %& asm operand


On Sun, Nov 8, 2009 at 2:39 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> %& emits some local dynamic TLS name in the current function, and asserts
> that at least one of them exists (which is fine for the internal usage
> in i386.md, but as %& can be (very likely only by mistake) used in user
> written inline asm, this results in ICE on invalid. ?This patch instead
> reports an error.
>
> Ok for trunk if bootstrap/regtest passes?

Ok.

Thanks,
Richard.

> 2009-11-08 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR target/41985
> ? ? ? ?* config/i386/i386.c (get_some_local_dynamic_name): Don't assert
> ? ? ? ?function contains at least one local dynamic name.
> ? ? ? ?(print_operand) <case '&'>: Instead output operand lossage diagnostics
> ? ? ? ?here if that happens.
>
> ? ? ? ?* gcc.target/i386/pr41985.c: New test.
>
> --- gcc/config/i386/i386.c.jj ? 2009-11-05 16:22:25.000000000 +0100
> +++ gcc/config/i386/i386.c ? ? ?2009-11-08 14:19:38.000000000 +0100
> @@ -11301,7 +11301,7 @@ get_some_local_dynamic_name (void)
> ? ? ? ?&& for_each_rtx (&PATTERN (insn), get_some_local_dynamic_name_1, 0))
> ? ? ? return cfun->machine->some_ld_name;
>
> - ?gcc_unreachable ();
> + ?return NULL;
> ?}
>
> ?/* Meaning of CODE:
> @@ -11353,8 +11353,15 @@ print_operand (FILE *file, rtx x, int co
> ? ? ? ? ?return;
>
> ? ? ? ?case '&':
> - ? ? ? ? assemble_name (file, get_some_local_dynamic_name ());
> - ? ? ? ? return;
> + ? ? ? ? {
> + ? ? ? ? ? const char *name = get_some_local_dynamic_name ();
> + ? ? ? ? ? if (name == NULL)
> + ? ? ? ? ? ? output_operand_lossage ("'%&' used without any "
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "local dynamic TLS references");
> + ? ? ? ? ? else
> + ? ? ? ? ? ? assemble_name (file, name);
> + ? ? ? ? ? return;
> + ? ? ? ? }
>
> ? ? ? ?case 'A':
> ? ? ? ? ?switch (ASSEMBLER_DIALECT)
> --- gcc/testsuite/gcc.target/i386/pr41985.c.jj ?2009-11-08 14:21:20.000000000 +0100
> +++ gcc/testsuite/gcc.target/i386/pr41985.c ? ? 2009-11-08 14:23:07.000000000 +0100
> @@ -0,0 +1,11 @@
> +/* PR target/41985 */
> +/* { dg-do compile } */
> +/* { dg-options "" } */
> +
> +int
> +main ()
> +{
> + ?int i;
> + ?asm volatile ("# %&" : : "g" (i)); ? /* { dg-error "used without any local dynamic TLS references" } */
> + ?return 0;
> +}
>
> ? ? ? ?Jakub
>


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