Thanks for the patch! I guess this is probably small enough it doesn't need copyright assignment (can you confirm, Jason?), but you should consider contributing either via DCO or with copyright assignment; see https://gcc.gnu.org/contribute.html#legal.
A changelog is also needed, if you've setup the GCC git customisation (see https://gcc.gnu.org/gitwrite.html#customization) you can use `git gcc-mklog` to create a template for this. A couple of other comments below. On Tue, Feb 03, 2026 at 06:54:40AM -0500, [email protected] wrote: > Fixing the error on checking for a non-existent header-unit, despite "-MG" > being used. > Resolving the bug 123622. > diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc > index 2d9b727d2b3..53e19644e22 100644 > --- a/gcc/cp/module.cc > +++ b/gcc/cp/module.cc > @@ -23302,21 +23302,26 @@ preprocess_module (module_state *module, location_t > from_loc, > > timevar_start (TV_MODULE_IMPORT); > > - /* Load the config of each pending import -- we must assign > - module numbers monotonically. */ > - for (unsigned ix = 0; ix != pending_imports->length (); ix++) > + if (!cpp_get_options (reader)->deps.missing_files || > + !flag_preprocess_only) The '||' should be on the start of this line. > { > - auto *import = (*pending_imports)[ix]; > - if (!(import->is_module () > - && (import->is_partition () || import->is_exported ())) > - && import->loadedness == ML_NONE > - && (import->is_header () || !flag_preprocess_only)) > + /* Load the config of each pending import -- we must assign > + module numbers monotonically. */ > + for (unsigned ix = 0; ix != pending_imports->length (); ix++) > { > - unsigned n = dump.push (import); > - import->do_import (reader, true); > - dump.pop (n); > + auto *import = (*pending_imports)[ix]; > + if (!(import->is_module () > + && (import->is_partition () || import->is_exported ())) > + && import->loadedness == ML_NONE > + && import->is_header ()) > + { > + unsigned n = dump.push (import); > + import->do_import (reader, true); > + dump.pop (n); > + } > } > } > + > vec_free (pending_imports); > > /* Restore the line-map state. */ > diff --git a/gcc/testsuite/g++.dg/modules/123622.C > b/gcc/testsuite/g++.dg/modules/123622.C > new file mode 100644 > index 00000000000..401f29ee6c4 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/modules/123622.C I would probably name this something like 'dep-6.C', to make it easier to find related testcases. I usually then keep the link to the PR using a comment on the first line: '// PR c++/123622'. > @@ -0,0 +1,5 @@ > +// { dg-additional-options "-fmodules -M -MG -MF 123622.d" } > + > +import "123622.h"; // Must not exist! > + > +// { dg-final { scan-file 123622.d {\nCXX_IMPORTS \+= > \./123622\.h\.c\+\+-module} } } Nathaniel
