Re: [PATCH gcc/* 2/2] gcc: stop using 'int' to represent sets of qualifiers

Arsen Arsenović <[email protected]> Thu, 09 Jul 2026 10:41:09 +0200
Newsgroups gmane.comp.gcc.rust,gmane.comp.gcc.patches,gmane.comp.gcc.fortran,gmane.comp.gcc.jit
Organization BayLibre
Message-ID <[email protected]>
When building stage1 with older host compilers, I noticed:

  gcc/tree.h:2561:63: warning: narrowing conversion of '(unsigned int)tree_class_check(type, tcc_type, ((const char*)"gcc/tree.h"), 7532, ((const char*)(& __FUNCTION__)))->tree_node::base.tree_base::u.tree_base::<unnamed union>::bits.tree_base::<unnamed union>::<unnamed struct>::address_space' from 'unsigned int' to 'addr_space_t' {aka 'unsigned char'} [-Wnarrowing]

Adding the following hunks to the patch fixes that, and should be
harmless.

1:  3d266b5af449 ! 1:  d0bd242aacbe gcc: stop using 'int' to represent sets of qualifiers
    @@ Commit message
                 use new qualifier_set APIs.
                 * omp-offload.cc (oacc_rewrite_var_decl): Update to use new
                 qualifier_set APIs.
    -            * tree-core.h (enum cv_qualifier): Set underlying type to
    +            * tree-core.h (tree_base): Use addr_space_t for 'address_space',
    +            to prevent Wnarrowing.
    +            (enum cv_qualifier): Set underlying type to
                 'unsigned char'.
                 (TYPE_QUAL_ALL): New.  Mask of all elements of cv_qualifier.
                 (operator|): New.  Returns union of two CV-qualifier sets.
    @@ gcc/tree-core.h
         Copyright (C) 1989-2026 Free Software Foundation, Inc.
      
      This file is part of GCC.
    +@@ gcc/tree-core.h: along with GCC; see the file COPYING3.  If not see
    + #ifndef GCC_TREE_CORE_H
    + #define GCC_TREE_CORE_H
    + 
    ++#include "coretypes.h"
    + #include "symtab.h"
    + 
    + /* This file contains all the data structures that define the 'tree' type.
     @@ gcc/tree-core.h: enum omp_memory_order {
      };
      #define OMP_FAIL_MEMORY_ORDER_SHIFT 3
    @@ gcc/tree-core.h: enum omp_memory_order {
      /* Standard named or nameless data types of the C compiler.  */
      enum tree_index : unsigned {
        TI_ERROR_MARK,
    +@@ gcc/tree-core.h: struct GTY(()) tree_base {
    + 	 For CONSTRUCTOR nodes this holds the clobber_kind enum.
    + 	 The C++ front-end uses this in IDENTIFIER_NODE, REFLECT_EXPR, and
    + 	 NAMESPACE_DECL.  */
    +-      unsigned address_space : 8;
    ++      addr_space_t address_space : 8;
    +     } bits;
    + 
    +     /* The following fields are present in tree_base to save space.  The
     
      ## gcc/tree-dump.cc ##
     @@ gcc/tree-dump.cc: dequeue_and_dump (dump_info_p di)

-- 
Arsen Arsenović
signature.asc (application/pgp-signature, 430 B)
-----BEGIN PGP SIGNATURE-----

iQEKBAEWCgCyFiEE/uKz0RP8AKMWLWBhUsKUMB6ixJMFAmpPXqYbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGRUUyQjNEMTEzRkMwMEEzMTYyRDYw
NjE1MkMyOTQzMDFFQTJDNDkzGBxhYXJzZW5vdmljQGJheWxpYnJlLmNvbQAKCRBS
wpQwHqLEk9l+AQDR7dgogJWR9SuI7aec9+xW3ZJwDlVyjhMXy5OeQWJwTAEAyd+o
gcS18bQvRLdSxG+x6jedz1MIp8qGZtwHvb7EgQc=
=soDT
-----END PGP SIGNATURE-----