Broken inline assembly syntax on the mob

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Broken inline assembly syntax on the mob

YX Hao

Dear there,

 

Since https://repo.or.cz/tinycc.git/commit/587e1f5598f2b0c35c7772bde486d47aa9a0cbbc,

this is observed by my test, using my personal mod of MinGW-w64

headers (https://github.com/lifenjoiner/MinGW-w64-tcc).

 

error:

 

`error: string constant expected`

 

One example from `_mingw.h`:

 

```

#include <stdio.h>

 

void __cdecl __debugbreak(void)

{

  __asm__ __volatile__("int {$}3":);

}

 

int main() {

    printf("1\n");

    return 0;

}

```

 

There are much more inline assembly in:

https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/include/psdk_inc/intrin-impl.h

 

 

Best Regards,

YX Hao

 


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

test_inline_asm.c (153 bytes) Download Attachment
Broken inline assembly syntax.md (636 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Broken inline assembly syntax on the mob

Michael Matz-4
Hi,

On Sat, 29 Jun 2019, Yuxi Hao wrote:

> `error: string constant expected`
>
>
>
>  __asm__ __volatile__("int {$}3":);

The error message is correct, you have a lone ':' in that asm, and that
must be followed by asm constraints (a string literal) or be removed.

Your example doesn't contain any inline functions, so I doubt it would
have worked before the indicated commit, but that commit caused some
inline functions to be parsed and syntax analyzed when they weren't before
the commit, so invalid source (like the above when contained within an
inline function) might have been accepted before and now is diagnosed.


Ciao,
Michael.

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Broken inline assembly syntax on the mob

YX Hao
In reply to this post by YX Hao

Michael, thanks for your reply and explanation.

 

I don’t know much about the inline ASM pieces. I just copied it from the MinGW-w64 headers. Please refer to:

 

https://github.com/mirror/mingw-w64/blob/6e5f2557a7097fc5415bf0495e50d37640dee54d/mingw-w64-headers/crt/_mingw.h.in#L583

 

https://github.com/mirror/mingw-w64/blob/6e5f2557a7097fc5415bf0495e50d37640dee54d/mingw-w64-headers/include/psdk_inc/intrin-impl.h#L200

 

 

Best Regards,

YX Hao

 


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel