https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87387

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
I found this bug by compiling gcc with the new clang 7.0

It seems that gcc can't be encouraged to warn about self-assignment.

For example:

$cat sep23a.cc
// -Wself-assign. clang has it. gcc doesn't.

extern void g( int);

void f(int n)
{
        int m = 2 * n;

        m = m;

        g( m);
}

$ ~/gcc/results/bin/gcc -c -O2 -Wall -Wextra sep23a.cc
$ 

Given that this warning finds bugs in gcc itself, would this
-Wself-assign warning be worth implementing in gcc ?

I'll have a go at compiling the rest of the world with clang-7.0
and see what it finds.

Reply via email to