[Bug c/101645] warn about neg of unsigned type should be added to -Wsign-conversion

2021-07-28 Thread matthew at wil dot cx via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101645 --- Comment #4 from Matthew Wilcox --- On second thoughts -Wsign-conversion is useless. Consider that it warns on this: unsigned long f(unsigned long x, int y) { return x + y; } Both gcc and clang emit a warning, which makes it useless.

[Bug c/101645] New: -Wsign-conversion misses negation of unsigned int

2021-07-27 Thread matthew at wil dot cx via Gcc-bugs
Component: c Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- Test case: unsigned long a(void); void b(long); void c(void) { unsigned int x = a(); b(-x); } There is a missed warning in the call to b(). x is negated, but as an int

[Bug c/99997] Missed optimisation with -Os

2021-04-09 Thread matthew at wil dot cx via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 Matthew Wilcox changed: What|Removed |Added CC||matthew at wil dot cx --- Comment #1

[Bug c/97287] New: Warn for expanding range of an arithmetic type

2020-10-04 Thread matthew at wil dot cx via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- I've just fixed multiple instances of bugs that look a lot like function f() when they should have been function g(). This affects filesystems in Linux which have to remember to cast

[Bug middle-end/32911] Function __attribute__ ((idempotent))

2020-08-06 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32911 Matthew Wilcox changed: What|Removed |Added CC||matthew at wil dot cx --- Comment #6

[Bug c/94382] New: conflicting function types should show more context

2020-03-28 Thread matthew at wil dot cx
Component: c Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- The diagnostic would be better if it showed the entire function prototype: ../fs/iomap/apply.c:13:1: error: conflicting types for ‘__iomap_apply’ 13 | __iomap_apply(struct

[Bug middle-end/88518] Function call defeats -Wuninitialized

2018-12-16 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88518 --- Comment #2 from Matthew Wilcox --- Thanks! What I actually want to do is annotate g() to the effect that it reads the pointed-to variable before it writes it. IOW, I want to write something like: void g(unsigned long

[Bug middle-end/88518] New: Function call defeats -Wuninitialized

2018-12-15 Thread matthew at wil dot cx
-end Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- void g(unsigned long *); void h(void); void f(void) { unsigned long i; h(); i++; g(); } $ gcc -Wall -O2 -c test5.c -o /dev/null reports

[Bug c/85055] New: warn on accessing free memory

2018-03-23 Thread matthew at wil dot cx
Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- GCC knows that a pointer passed to free() is no longer valid, but it misses an opportunity to warn here: char f(char *foo) { free(foo); return foo[0]; }

[Bug c/85053] New: free not listed as built-in

2018-03-23 Thread matthew at wil dot cx
: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- The function free() is not listed as a built-in in the manual, but the source code has several references to BUILT_IN_FREE. I believe the manual should be adjusted as so: -@code{fprintf}, @code{fputs

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #14 from Matthew Wilcox --- Confirmed this fixes the problem. I'll send it to Tony and see if he likes it. May I add your Signed-off-by to the patch?

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #11 from Matthew Wilcox --- I'm sorry, I still don't get it. What I think you're saying is that GCC performs this optimisation: nr = 1UL << compound_order(page); atomic_sub_return(x, nr); into: if (PageHead(page))

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #9 from Matthew Wilcox --- Maybe I'm a little slow, but I don't see what the path is that sets 'nr' to 0. It's 1UL << compound_order. Typically, compound_order is 0, although it may be anything up to log2(number of pages in the

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #7 from Matthew Wilcox --- OK, so how should we write this function/macro to accomplish what we want? And the requirement is "If the argument is one of these eight special constants, use this special instruction, otherwise call this

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-10 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #5 from Matthew Wilcox --- Hi Aldy! Thanks for looking into this. Yes, I agree, there's no way that GCC can know this is a constant, but that *should* have been taken care of. Please pardon me copying and pasting from the original

[Bug middle-end/83653] [6 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-08 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #2 from Matthew Wilcox --- 7.2, 6.2, 5.5 and 4.9 fail. 4.6.3 succeeds.

[Bug c/83653] New: GCC fails to remove a can't-happen call on ia64

2018-01-02 Thread matthew at wil dot cx
: c Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- Created attachment 43009 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43009=edit Gzipped preprocessed source This is an excerpt from the Linux kernel, with some patc

[Bug tree-optimization/83377] New: Missed optimization (x86): Bit operations should be converted to arithmetic

2017-12-11 Thread matthew at wil dot cx
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: matthew at wil dot cx Target Milestone: --- GCC fails to optimise if (x & 2) y = (x &~ 2) into if (x & 2) y = (x - 2) in cases wher