Re: [attribs.cc] ICE with 4x underscores

2024-01-30 Thread Marek Polacek via Gcc
On Tue, Jan 30, 2024 at 12:25:24PM +, Jonathan Wakely via Gcc wrote:
> On Tue, 30 Jan 2024, 10:35 Amol Surati via Gcc,  wrote:
> 
> > Hello,
> >
> > If a std attribute name is squeezed between 4x underscores,
> >
> 
> Which is undefined behaviour, but shouldn't crash.
> 
> the compiler (both 13.2 [1] and trunk [2]) experiences an ICE.
> >
> 
> Bug reports belong in bugzilla, not on the mailing list please.
> 
> https://gcc.gnu.org/bugs/

I've created :
[[attr]] causes internal compiler error: in decl_attributes, at 
attribs.cc:776

which crashes with both cc1{,plus}.  The problem happens when the attribute
is both in std_attributes and c_common_gnu_attributes, it seems.

Marek



Re: [Patch, stage-1, RFC]: i386: attribute regparm/stdcall and vaargs

2024-01-30 Thread Joseph Myers via Gcc
On Tue, 30 Jan 2024, Bernhard Reutner-Fischer via Gcc wrote:

>   * builtin-attrs.def (ATTR_TM_NOTHROW_RT_LIST): Use ATTR_NOTHROW_LIST
>   instead of ATTR_TM_NOTHROW_LIST, thus removing ATTR_TM_REGPARM.

That doesn't make sense.  ATTR_TM_NOTHROW_RT_LIST is specifically a 
transactional memory attribute list, but you're removing all transactional 
memory attributes from it.  A list without the "*tm regparm" internal 
attribute would have a different name.

-- 
Joseph S. Myers
josmy...@redhat.com



Re: [attribs.cc] ICE with 4x underscores

2024-01-30 Thread Jonathan Wakely via Gcc
On Tue, 30 Jan 2024, 10:35 Amol Surati via Gcc,  wrote:

> Hello,
>
> If a std attribute name is squeezed between 4x underscores,
>

Which is undefined behaviour, but shouldn't crash.

the compiler (both 13.2 [1] and trunk [2]) experiences an ICE.
>

Bug reports belong in bugzilla, not on the mailing list please.

https://gcc.gnu.org/bugs/

for e.g. when using [[deprecated]] int a;
>
> But, [[depreated]] int a; (i.e. the char 'c' removed from the
> spelling) does not cause ICE.
>
> Clang does not crash.
>
> Stack trace with ICE:
>
> :1:1: internal compiler error: in decl_attributes, at
> attribs.cc:751
> 1 | [[deprecated]] int a;
>   | ^
> 0x1b49b1e internal_error(char const*, ...)
> ???:0
> 0x6f805c fancy_abort(char const*, int, char const*)
> ???:0
> 0x70f62d decl_attributes(tree_node**, tree_node*, int, tree_node*)
> ???:0
> 0x728c0e start_decl(c_declarator*, c_declspecs*, bool, tree_node*,
> bool, unsigned int*)
> ???:0
> 0x7865dd c_parse_file()
> ???:0
> 0x7e60b9 c_common_parse_file()
> ???:0
>
> Thank you,
> Amol
>
> [1] https://godbolt.org/z/6PaMd9n6x
> [2] https://godbolt.org/z/fc48q5PTW
>


Re: Building a GCC backend for the STM8

2024-01-30 Thread Oleg Endo
Hi,

On Sun, 2024-01-28 at 04:41 +0100, Sophie 'Tyalie' Friedrich via Gcc wrote:
> Hello dear people,
> 
> I want to try building a GCC compiler backend for the STM8 
> micro-controller target in order to make this wonderful architecture 
> more accessible.
> 
> But as I'm fairly new in this area of building compiler backends for 
> GCC, I would need a bit of guidance / read material to get started. Do 
> you have recommendations for anything? And is there interest in such work?
> 
> With best regards
> Tyalie

GCC might not be a bit difficult for 8-bit targets.  For example, if you
look at RL78, it had to resort to some virtual register set workaround
because GCC usual register allocation at that time couldn't deal with it. 
8-bit targets like AVR seem to be a bit easier.

Some other interesting options for 8-bit targets are SDCC (STM8 already
supported it seems) and llvm-mos project (LLVM port originally for 6502).

Cheers,
Oleg


[attribs.cc] ICE with 4x underscores

2024-01-30 Thread Amol Surati via Gcc
Hello,

If a std attribute name is squeezed between 4x underscores,
the compiler (both 13.2 [1] and trunk [2]) experiences an ICE.
for e.g. when using [[deprecated]] int a;

But, [[depreated]] int a; (i.e. the char 'c' removed from the
spelling) does not cause ICE.

Clang does not crash.

Stack trace with ICE:

:1:1: internal compiler error: in decl_attributes, at attribs.cc:751
1 | [[deprecated]] int a;
  | ^
0x1b49b1e internal_error(char const*, ...)
???:0
0x6f805c fancy_abort(char const*, int, char const*)
???:0
0x70f62d decl_attributes(tree_node**, tree_node*, int, tree_node*)
???:0
0x728c0e start_decl(c_declarator*, c_declspecs*, bool, tree_node*,
bool, unsigned int*)
???:0
0x7865dd c_parse_file()
???:0
0x7e60b9 c_common_parse_file()
???:0

Thank you,
Amol

[1] https://godbolt.org/z/6PaMd9n6x
[2] https://godbolt.org/z/fc48q5PTW