6.4 How a patch gets proposed: MAINTAINERS, gcc-patches and backports

Source references in this chapter are to GCC 15.2.0 (releases/gcc-15.2.0).

The process in this chapter was checked on 2026-10-26, against the gcc.gnu.org pages that the first table dates. The source files are pinned. The process is not, and it changes without a release.

You have a fix for GCC. It bootstraps, and it has a test. You look in the tree for the rules on how to submit it. gcc/doc/contribute.texi is 24 lines long and sends you to a web page. MAINTAINERS gives you several hundred names and no procedure. The procedure is on four web pages, and the tools that serve it are in contrib/. The pages change on any day. The tools change with each release. On the day this chapter was checked, they disagreed in three places.

This chapter reads the files and the pages side by side, and then follows one real patch from the gcc-patches list into the 15.2.0 release tree.

This chapter assumes Chapter 6.1, for the test that a patch adds, and Chapter 6.3, for the ChangeLog entry in the commit message and the checker in contrib/gcc-changelog/. Chapter 2.5 and Chapter 3.7 explain the bootstrap and the test run that a submission reports.

There is no command that shows this mechanism working, because review is people reading mail. This is the one chapter in the book with no observable. What you can open is the record that a patch leaves: the archived mail, the Bugzilla entry, the commits, and the ChangeLog entry in the release tree. The contrib/ commands below were not run for this book, which has no GCC checkout. Each claim about them comes from the script at the pin.

Where the rules live: contribute.texi, MAINTAINERS and four web pages

The GCC manual and the internals manual include the same file for the process, and it is a pointer. Chapter 6.2 explains how the gcc/doc sources become the manuals.

If you would like to work on improvements to GCC, please read the
advice at these URLs:

@smallexample
@uref{https://gcc.gnu.org/contribute.html}
@uref{https://gcc.gnu.org/contributewhy.html}
@end smallexample

Listing 6.4-1: the manual's advice on contributing (gcc/doc/contribute.texi:13-19).

So the rules come from six places. Two are in the tree and four are not:

SourceWhat it holdsVersion
MAINTAINERSwho may approve and who may commit, and the DCO listpinned
contrib/git aliases, the ChangeLog checker, the backport scriptpinned
contribute.htmlwhat a submission contains, subject lines, testingmodified 2026-07-23
gitwrite.htmlwrite-access levels, obvious fixes, committingmodified 2026-07-21
develop.htmldevelopment stages, release-branch policy, revertsmodified 2026-09-11
dco.htmlthe Signed-off-by: ruleno date on the page

The pages are the project's policy for work on master today. The files tell you what one release's tools do. Where the two disagree, this chapter says so at the claim.

Reading MAINTAINERS: who may approve what

MAINTAINERS is at the top of the tree. It describes itself as a list of "people who are permitted to make changes to various parts of the compiler and associated libraries", and asks you not to contact them directly to report problems (MAINTAINERS:4-8). Most of its sections are levels of authority, and gitwrite.html gives the levels their names:

  • Global Reviewers (:32) can approve a change to any part of the compiler.
  • CPU Port, OS Port, Language Front Ends and Various Maintainers (:55, :136, :158, :177) have localized write permission. They commit to their area without approval, and they approve other people's changes there.
  • Reviewers (:276) have localized review permission. They approve changes in their area, but their own patches need someone else's approval.
  • Write After Approval (:328) is everyone else with commit access. They commit only after the appropriate maintainer approves.

The file itself states two of the rules that go with these levels:

Note that while global reviewers can approve changes to any part of
the compiler or associated libraries, they still need approval for
their own patches from other maintainers or reviewers.

Also note that maintainership of any area covers changes to web pages,
docs, and the testsuite related to that.

Listing 6.4-2: two rules in the file's own text (MAINTAINERS:48-53).

It repeats the first rule for maintainers who change code outside their area (:273-274) and for reviewers (:324-326). The second rule means the owner of an area also approves its tests and its documentation.

gitwrite.html adds a sentence that the file does not have: "We have not put any technical enforcement in place, rather we rely on everyone to follow the appropriate policies." The tree agrees. The ChangeLog checker skips a Reviewed-by: line and six other trailers, and records nothing from them (contrib/gcc-changelog/git_commit.py:188-190, :530-531). The checker keeps no record of who approved a patch.

Finding your reviewer: areas, not paths

The first column of an area section is free text, not a path pattern. You search it for the nearest area name. For a change to gcc/tree-sra.cc, these are the nearest lines:

middle-end              Jeff Law                <jeffreyalaw@gmail.com>
middle-end              Ian Lance Taylor        <ian@airs.com>
middle-end              Richard Biener          <rguenther@suse.de>
*vrp, ranger            Aldy Hernandez          <aldy@quesejoda.com>
*vrp, ranger            Andrew MacLeod          <amacleod@redhat.com>
tree-ssa                Andrew MacLeod          <amacleod@redhat.com>

Listing 6.4-3: area names, as people wrote them (MAINTAINERS:242-247).

If no area fits, a global reviewer fits. Richard Biener is in both lists (:34), and the patch that this chapter traces went to him.

The Write After Approval section has three columns: name, Bugzilla account and email (:330). The account is the person's login on gcc.gnu.org. To copy a maintainer on a Bugzilla entry, add @gcc.gnu.org to that account name (:18-20). An entry in this section gives commit access. It gives no right to approve.

At the pin, a new committer adds their own line by hand, and contrib/check-MAINTAINERS.py checks the sort order (:26-27) of four sections (check-MAINTAINERS.py:123-129). This changed on master after 15.2. Since 2026-07-07, MAINTAINERS is generated from MAINTAINERS.yml by contrib/gen-MAINTAINERS.py, and check-MAINTAINERS.py is gone (commit 89d27e50). Neither the releases/gcc-16.1.0 nor the releases/gcc-16.2.0 tag has the YAML file. contribute.html and gitwrite.html already describe the YAML procedure, so they are wrong for a 15.2, 16.1 or 16.2 tree.

FSF assignment or Signed-off-by: the DCO section of MAINTAINERS

The first question a new contributor meets is legal: can the project accept your code? As of 2026-10-26, contribute.html gives three routes:

  1. An FSF copyright assignment. The FSF prefers it for large contributions. The common forms are an assignment for one change, an assignment for all future changes, and an employer disclaimer when an employer or school owns the work. To get the forms, ask on gcc@gcc.gnu.org or ask the maintainer who handles your contribution, and copy assign@gnu.org.
  2. A Developer Certificate of Origin (DCO) sign-off. You add a Signed-off-by: line with a known identity, not an anonymous one. git commit -s adds the line for you (dco.html). By signing, you certify that you have the right to submit the code under the file's license.
  3. Nothing, for small changes that the FSF does not count as legally significant.

A committer can certify the DCO once, for all future commits, with a line in the last section of MAINTAINERS:

                        Contributing under the DCO

By adding your name and email to this section, you certify that all your
subsequent contributions to GCC are made under the terms of the Developer's
Certificate of Origin Version 1.1.  See https://gcc.gnu.org/dco.html for more
information.

Listing 6.4-4: the DCO list (MAINTAINERS:927-932).

dco.html requires a Signed-off-by: line for any contribution that neither an FSF assignment nor this list covers. contribute.html adds that an entry is permanent once you have committed with its email address. A new address needs a new entry. dco.html puts the Signed-off-by: line at the end of the explanation. The ChangeLog checker skips the line, so it can also follow the ChangeLog entries (git_commit.py:188-190). The checker does not check that the line is there.

What a gcc-patches mail must carry

contribute.html lists five things that every submission needs:

  1. A description of the problem and of how the patch fixes it, with the Bugzilla PR number if there is one.
  2. A test case, or the reason why you cannot add one. Chapter 6.1 covers writing it.
  3. A ChangeLog entry, as plain text. Chapter 6.3 covers its format, and git gcc-commit-mklog writes a skeleton.
  4. A testing statement: the host and target triples you tested on, and the result.
  5. The patch, including every regenerated file, each noted in the ChangeLog, for example * configure: Regenerate.

Send one logical change per patch, and keep formatting changes apart from real ones. Send the patch as plain text, or as a text/x-patch or text/plain MIME part. Do not send it as an attachment or in base64. A documentation change also needs make info and make dvi to run without errors.

The testing that item 4 reports depends on what you changed. As of 2026-10-26, contribute.html asks for this:

Your change touchesRequired testing
anything outside a front end, or the C or C++ front endmake bootstrap, then make -k check, from the top of the build tree, all default languages
the C++ front endthe above, and make -C gcc -k check-c++-all for every standard level
another front end, or a runtime library other than libgccbuild that library, and check that its language's tests did not regress
the Ada front enda full bootstrap, because the front end is written in Ada

In every case, you test exactly the change you submit, in a tree with no other change. You compare the results with a run before the patch, or with recent posts to gcc-testresults. The install manual documents make check under Testing. Chapter 2.5 explains what make bootstrap does, and Chapter 3.7 compares two runs with contrib/compare_tests.

The mail is the commit message: git_email.py

contribute.html says that the subject line of your mail "will become the first line of the commit message". The checker for a patch file builds the commit message in the same way:

subject_patch_regex = re.compile(r'^\[PATCH( \d+/\d+)?\] ')
...
        if subject:
            subject = subject_patch_regex.sub('', subject)
        header = list(takewhile(lambda line: line != '', lines))
        # Note: commit message consists of email subject, empty line, email body
        message = [subject] + lines[len(header):]

Listing 6.4-5: from mail to commit message (contrib/gcc-changelog/git_email.py:35 and :67-71).

The body ends at the first --- line (:51), which is the line that git format-patch writes above the diffstat. So the ChangeLog entries go above that line, and they are part of the message. You can check a patch file before you send it:

$ contrib/gcc-changelog/git_email.py 0001-my-fix.patch

It prints OK and the ChangeLog entries that the commit will produce, or the errors (:135-143). It needs the Python modules unidiff and dateutil (:26, :30).

The subject line: [PATCH v2 3/7] component: summary [PRnnnnn]

As of 2026-10-26, contribute.html gives a subject line five parts:

  • A classifier in square brackets: [PATCH], [PATCH v2] for a second version, [PATCH 3/7] for one patch of a series, [RFC] for discussion, or [COMMITTED] for a patch that needed no approval. It is the only part that is not committed.
  • Component tags, each followed by a colon: libstdc++:, combine:, vax: testsuite:. They tell the right maintainers to read the patch.
  • An optional series identifier, followed by -.
  • A short summary, distinct from other patches.
  • An optional bug number, as [PR12345], with no component and no space.

The whole line, without the classifier, should be 75 characters or fewer. The body still carries the full PR component/12345 form, so that Bugzilla notices the commit. The checker enforces that half of the rule:

subject_pr_regex = re.compile(r'(^|\W)PR\s+(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})')
subject_pr2_regex = re.compile(r'[(\[]PR\s*(?P<pr>\d{4,7})[)\]]')
...
        if self.subject_prs:
            self.errors.append(Error('PR %s in subject but not in changelog' %
                                     ', '.join(self.subject_prs), self.info.lines[0]))

Listing 6.4-6: a PR in the subject must also be in the ChangeLog (contrib/gcc-changelog/git_commit.py:173-174 and :391-393).

A PR component/nnnnn line in the ChangeLog part removes the number from the set (:519-520). Round brackets work as well as square ones. The checker does not measure the subject. Its 100-column limit applies to ChangeLog lines (:477-481), and its only test on the subject is that the next line is empty (:329-330).

The classifier rule and Listing 6.4-5 disagree. git format-patch -v2 writes [PATCH v2], but subject_patch_regex removes only [PATCH] and [PATCH n/m]. For a [PATCH v2], [RFC] or [COMMITTED] file, git_email.py keeps the classifier in the subject that it checks.

Sending it: git send-email and sendemail.to

contrib/gcc-git-customization.sh sets up a checkout for this work. It defines the git gcc-* aliases (:25-37), offers to install the prepare-commit-msg hook (:145-157), and sets the address:

# Tell git send-email where patches go.
# ??? Maybe also set sendemail.tocmd to guess from MAINTAINERS?
git config sendemail.to 'gcc-patches@gcc.gnu.org'

Listing 6.4-7: the list, but no reviewer (contrib/gcc-git-customization.sh:44-46).

The ??? comment records that the script does not pick reviewers from MAINTAINERS. You find the reviewer yourself and copy them:

$ git format-patch -1
$ git send-email --cc=reviewer@example.org 0001-my-fix.patch

git send-email uses sendemail.to when you give no --to. Its documentation gives its default threading: every mail after the first one replies to the first one. That is the shape contribute.html asks for in a series. The first mail is [PATCH 0/N], which git format-patch --cover-letter writes, and patches 1 to N reply to it. The cover letter is not committed, so it should hold nothing important that the patches do not also say.

A second version starts a new thread. Its cover letter says what changed and which patches did not change. Then you reply to the old thread with a pointer to the new one. If nobody answers in about two weeks, contribute.html says to send a follow-up to the same list, with a short summary and the archive URL of the first mail.

If you do not have commit access, say so in the submission. When the patch is approved, tell the approver. The person who commits it for you uses git commit --author, so that the commit names you (gitwrite.html).

One patch end to end: PR 117423

The traced patch is a wrong-code fix in scalar replacement of aggregates (SRA), in gcc/tree-sra.cc (:1). It is small, it went through review, and a backport put it in the 15.2.0 tree, so the last step is a file at the pin.

2025-07-17: the [PATCH] mail

Bugzilla PR 117423 was filed on 2024-11-03. At the time of writing, its summary is "[13 Regression] union not written to with particular layout since r10-6321-g636e80eea24b78", and its keyword is wrong-code. Martin Jambor assigned it to himself on 2025-07-17 and posted the fix that evening:

From: Martin Jambor <mjambor@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <rguenther@suse.de>
Subject: [PATCH] tree-sra: Fix grp_covered flag computation when totally
 scalarizing (PR117423)
Date: Thu, 17 Jul 2025 22:35:28 +0200

Hi,

testcase of PR 117423 shows a flaw in the fancy way we do "total
scalarization" in SRA now.  ...

Bootstrapped and tested on x86_64-linux, I'm also running a bootstrap
and testing on aarch64-linux as I'm writing this but will know the
results only tomorrow.  OK for master and later for all active release
branches if it passes there too?

Thanks,

Martin


gcc/ChangeLog:

2025-07-17  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/117423
	* tree-sra.cc (analyze_access_subtree): Fix computation of grp_covered
	flag.

gcc/testsuite/ChangeLog:

2025-07-17  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/117423
	* gcc.dg/tree-ssa/pr117423.c: New test.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr117423.c | 49 ++++++++++++++++++++++++
 gcc/tree-sra.cc                          |  9 ++++-
 2 files changed, 56 insertions(+), 2 deletions(-)

Listing 6.4-8: the posting, abridged: the description and the diff are cut (message on gcc-patches).

All five parts are there. The description explains the flaw. The test is an execution test at -O1 (gcc/testsuite/gcc.dg/tree-ssa/pr117423.c:1-2). There is one ChangeLog entry for each directory that has a ChangeLog. The testing statement names one host and promises a second. The diffstat shows the patch. The subject has the component tag tree-sra: and the PR in round brackets, which subject_pr2_regex accepts. Without the classifier, it is 78 characters long.

The approval request is also there, and the Cc: line shows why. Jambor is a reviewer for the callgraph (MAINTAINERS:279) and has write after approval (:561). tree-sra.cc is outside his area, so he needed an approval, and he copied a global reviewer.

2025-07-18: OK. and the commit r16-2347

Biener replied at 09:09 the next morning. Below the quoted request, his answer is "OK." and a thank-you. That word approved the question it answered, so it covered master and the release branches.

Jambor committed the patch to master the same day, as commit 7375909e. Its message is the mail without the greeting, the testing statement, the question and the signature. Its first line is the mail's subject without [PATCH]. A bot then added a comment to the Bugzilla entry. It begins "The master branch has been updated by Martin Jambor", and it names the commit r16-2347-g7375909e9d9e7de23acb4b1e0a965d8faf1943c4.

That rN-M form is GCC's name for a commit. git gcc-descr (gcc-git-customization.sh:25) runs contrib/git-descr.sh, which runs git describe --match 'basepoints/gcc-[0-9]*' and changes the basepoints/gcc- prefix to r (contrib/git-descr.sh:21-25). The bug summary uses the same form, r10-6321, for the commit that caused the regression.

2025-07-23: git gcc-backport and cherry-pick -x

Five days later the fix reached releases/gcc-15, as commit 420b1632 (r15-10058). Its message is the master message with one more line at the end:

(cherry picked from commit 7375909e9d9e7de23acb4b1e0a965d8faf1943c4)

git cherry-pick -x writes that line, and that command is what the gcc-backport alias runs (gcc-git-customization.sh:29):

    subprocess.run('git cherry-pick -x %s' % args.revision, shell=True)
    subprocess.run(fixup_script, shell=True)

Listing 6.4-9: a backport is a cherry-pick (contrib/git-backport.py:34-35).

The second script repairs file names in the ChangeLog part of the message when they point to files that now end in .cc (contrib/git-fix-changelog.py:22-23).

gitwrite.html describes an older script. It says the alias runs git cherry-pick -x "and reverts all modifications of ChangeLog files". That was GCC 11's git-backport.py. After the cherry-pick, it restored every ChangeLog file that the commit had changed (releases/gcc-11.1.0: contrib/git-backport.py:26-38). At 15.2, the script does not touch ChangeLog files.

At the pin: Backported from master: in gcc/ChangeLog

The ChangeLog checker reads the cherry picked from commit line (git_commit.py:182). A cron job writes each commit into the branch's ChangeLog files (:370-373). For a backport, it adds a header:

            if self.cherry_pick_commit or self.revert_commit:
                original_author = self.original_info.author
                output += self.format_authors_in_changelog([original_author],
                                                           current_timestamp)
                if self.revert_commit:
                    output += '\tRevert:\n'
                else:
                    output += '\tBackported from master:\n'

Listing 6.4-10: the backport header (contrib/gcc-changelog/git_commit.py:831-838).

The result is in every 15.2.0 tree:

2025-07-23  Martin Jambor  <mjambor@suse.cz>

	Backported from master:
	2025-07-18  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/117423
	* tree-sra.cc (analyze_access_subtree): Fix computation of grp_covered
	flag.

Listing 6.4-11: the end of the trace (gcc/ChangeLog:276-283).

The outer date is the backport. The inner date is the master commit. It is not the 2025-07-17 in the mail, because for a cherry-pick the generator takes the date from the original commit (git_commit.py:809-815). gcc/testsuite/ChangeLog has the same entry for the test (:783-789), and the fix itself is at gcc/tree-sra.cc:2898-2901.

Bugzilla records two more backports. releases/gcc-14 got a cherry-pick of the same master commit on 2025-08-20 (r14-11970), and releases/gcc-13 got the fix on 2025-09-17 (r13-9891).

Branch policy: stages on master, regressions on releases/gcc-N

Why could this fix go to three release branches? develop.html (modified 2026-09-11) sets the rules, in stages on master:

  • Stage 1 lasts at least four months. Any change can go in, and large work merges from development branches.
  • Stage 3 lasts about two months. Only bug fixes, and new ports that change nothing else, can go in. Stage 2 was abandoned with GCC 4.4.
  • Stage 4 takes regression fixes, and "other important bugs like wrong-code, rejects-valid or build issues". It lasts until the next Stage 1. The page adds: "Note that the same constraints apply to release branches."

The release branch is cut when master has no P1 regressions. After that, a bug-fix release takes fixes for regressions and serious bugs. A backport should not make the compiler reject code that it accepted before, unless accepting it gave incorrect object code or code with undefined behaviour.

PR 117423 qualifies twice. It is a regression since r10-6321, and it is wrong code. master was in GCC 16 Stage 1, which started on 2025-04-17, so the fix needed only review. The backport went to releases/gcc-15 16 days before 15.2 was released on 2025-08-08. Both dates are from develop.html.

Two smaller rules complete the picture. gitwrite.html lets anyone with commit access commit an obvious fix without approval and copy it to gcc-patches. Its test is: "will the person who objects to my work the most be able to find a fault with my fix?" Such a mail uses the [COMMITTED] classifier. develop.html lets two people with write access to the area revert a patch that breaks an important target. They must first report the problem to the author and wait 48 hours for a promise of a fix. You can always revert your own patch without approval.

Three things to carry away

MAINTAINERS says who, and the web pages say how. Nothing enforces the approval rules.

The gcc-patches mail is the commit. The subject becomes the first line, and the body above --- becomes the message, ChangeLog entries included.

A backport is git cherry-pick -x of a master commit. Its (cherry picked from commit line becomes Backported from master: in the branch's ChangeLog.

Things that surprise people

An LGTM approves nothing unless it comes from someone MAINTAINERS lists for that area. gitwrite.html asks for approval by "the appropriate maintainers".

The 75-character subject limit is advice. The traced subject has 78 characters, and the checker does not measure subjects.

Backported from master: is a fixed string. git_commit.py writes it for every cherry-pick (:838), whatever branch the original commit is on.

Two scripts in contrib/ still drive Subversion. prepare_patch.sh and patch_tester.sh call svn (prepare_patch.sh:57, patch_tester.sh:164). GCC's own aliases treat SVN as history: the svn-rev alias finds a commit by its From-SVN: line (gcc-git-customization.sh:20-21).

Documentation coverage

The Contributing node is the only manual text on the process (gcc/doc/contribute.texi:5). The GCC manual includes it at gcc/doc/gcc.texi:187, and the internals manual includes it as its own Contributing node at gcc/doc/gccint.texi:140. It links contribute.html and contributewhy.html, and states no rule. The install manual documents make check in its Testing node (gcc/doc/install.texi:3393), but not the testing that a submission needs.

What no manual documents:

  • The sections of MAINTAINERS, the approval levels and the DCO list. The file documents itself in part, and gitwrite.html names the levels.
  • The FSF and DCO routes, the contents of a submission, the subject-line format and the testing levels. contribute.html and dco.html document them.
  • The stage policy and the backport rules. develop.html documents them.
  • The git gcc-* aliases. gitwrite.html describes them.
  • That a PR number in the subject must also be in the ChangeLog part (git_commit.py:391-393). None of the four pages says so.

Where the pages and the pin disagree, as of 2026-10-26:

  • contribute.html and gitwrite.html describe MAINTAINERS.yml and contrib/gen-MAINTAINERS.py. At the pin, and in 16.1 and 16.2, you edit MAINTAINERS by hand and check it with contrib/check-MAINTAINERS.py.
  • gitwrite.html says that git gcc-backport reverts ChangeLog changes. The script did that in GCC 11. At 15.2 it does not.
  • contribute.html lists [PATCH v2], [RFC] and [COMMITTED] as classifiers. contrib/gcc-changelog/git_email.py removes only [PATCH] and [PATCH n/m].

All source references in this chapter are to GCC 15.2.0 (releases/gcc-15.2.0). Line numbers in other releases will differ; the surrounding code rarely does. Where behaviour itself changed across a major version, it is flagged inline.