Bug 105914 - gccrs setting warn_unused_variable breaks thousands of non-Rust tests
Summary: gccrs setting warn_unused_variable breaks thousands of non-Rust tests
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rust (show other bugs)
Version: rust/master
: P3 normal
Target Milestone: ---
Assignee: Thomas Schwinge
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-10 11:28 UTC by Rainer Orth
Modified: 2022-12-01 08:24 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-06-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2022-06-10 11:28:17 UTC
I've just finished bootstrapping the devel/rust/master branch on all of Linux/x86_64,
Linux/i686, Solaris/x86_64, and Solaris/x86 with --enable-languages=rust.

The rust testresults are fine everywhere, but one change badly breaks C and C++
tests like this:

FAIL: gcc.c-torture/compile/pr99787-1.c   -O0  (test for excess errors)
Excess errors:
/vol/gcc/src/git/rust/gcc/testsuite/gcc.c-torture/compile/pr99787-1.c:10:12: warning: unused variable 'f' [-Wunused-variable]

There are several thousand failures like this, all over the place (gcc, g++,
libgomp, libitm, libstdc++).  I'm pretty certain this is due to this snippet
in gcc/rust/lang.opt:

Wunused-variable
Rust Var(warn_unused_variable) Init(1) Warning
; documented in common.opt

Obviously this causes the warning to default to on for every language, not just
for Rust.  I haven't tried looking how to avoid this.
Comment 1 Thomas Schwinge 2022-06-10 12:24:44 UTC
Right, I've run into this, too.  (Bootstrap failure even, with Ada enabled.)

I have half-finished patches to address this, and also patches to improve GCC's options machinery, to make it unlikely that similar breakage happens in the future.  :-)
Comment 2 Arthur Cohen 2022-11-15 18:55:25 UTC
Hi there :) This should be fixed now. We decided to enable the warning from within the frontend instead of within the build files.
Comment 3 Thomas Schwinge 2022-12-01 08:24:16 UTC
The issue at hand has been resolved via <https://github.com/Rust-GCC/gccrs/pull/1570> "Apply #1560 master", and my "patch series adding a 'LangInit(@var{language}, @var{value})' option property" can then later be applied here, too, once I've got that completed...  ;-|