Re: [Tinycc-devel] undefined sanitizer

2019-06-22 Thread Christian Jullien
> Yes, it's implementation defined, but I assume that -fsanitize=undefined > warns only when the implementation has decided that this was incorrectly > aligned. It's nice to have this warning even if implementation supports incorrect alignment. Suppose I provide a portable C library which will

Re: [Tinycc-devel] undefined sanitizer

2019-06-22 Thread Vincent Lefevre
On 2019-06-22 20:59:57 +0200, Michael Matz wrote: > Hi, > > On Sat, 22 Jun 2019, Vincent Lefevre wrote: > > > > > I keep having fun. > > > > In attach compile report under -fsanitize=undefined in gcc or clang. > > > > Take care. > > > > > > I don't think we should care about alignment of 4

Re: [Tinycc-devel] match formats and arguments exactly

2019-06-22 Thread Vincent Lefevre
On 2019-06-22 20:34:35 +0200, Michael Matz wrote: > Hi, > > On Sat, 22 Jun 2019, Vincent Lefevre wrote: > > > > I don't object, but have a request: can you explore if changing > > > the type of the respective variable, instead of adding casts, is > > > equivalent? Especially the changes in

Re: [Tinycc-devel] missing check after calling type_size in classify_x86_64_arg

2019-06-22 Thread Michael Matz
Hello, On Sat, 22 Jun 2019, Pascal Cuoq wrote: That is a big can of worm you have pointed me to. Historically TCC hasn't cared much about invalid input, so yeah, there be dragons :) Here is another part of the code that seems wrong and continues to seem wrong even with the suggested

Re: [Tinycc-devel] undefined sanitizer

2019-06-22 Thread Michael Matz
Hi, On Sat, 22 Jun 2019, Vincent Lefevre wrote: > I keep having fun. > In attach compile report under -fsanitize=undefined in gcc or clang. > Take care. I don't think we should care about alignment of 4 (when 8 would be needed). The 64bit platforms we support all handle misaligned memory

Re: [Tinycc-devel] match formats and arguments exactly

2019-06-22 Thread Michael Matz
Hi, On Sat, 22 Jun 2019, Vincent Lefevre wrote: I don't object, but have a request: can you explore if changing the type of the respective variable, instead of adding casts, is equivalent? Especially the changes in parse_escape_string look as if that's possible. (I consider such type change

Re: [Tinycc-devel] missing check after calling type_size in classify_x86_64_arg

2019-06-22 Thread Pascal Cuoq
Hello Michael, and thanks for the guidance. On 22 Jun 2019, at 01:17, Michael Matz mailto:matz@frakked.de>> wrote: Yes, there are generally two contexts, and in one of them (e.g. decls with initializers) incomplete types are temporarily valid. So you'd either need two modes of type_size

Re: [Tinycc-devel] undefined sanitizer

2019-06-22 Thread Vincent Lefevre
On 2019-06-22 00:43:48 +0200, Michael Matz wrote: > Hi, > > On Tue, 18 Jun 2019, Mike wrote: > > > I keep having fun. > > In attach compile report under -fsanitize=undefined in gcc or clang. > > Take care. > > I don't think we should care about alignment of 4 (when 8 would be needed). > The

Re: [Tinycc-devel] match formats and arguments exactly

2019-06-22 Thread Vincent Lefevre
On 2019-06-22 01:07:17 +0200, Michael Matz wrote: > On Fri, 21 Jun 2019, Pascal Cuoq wrote: > > If no-one objects, I will push in a few days the following patch, > > I don't object, but have a request: can you explore if changing the type of > the respective variable, instead of adding casts, is