1. 03 Jul, 2019 16 commits
    • [Ada] Fix bogus error on array with overaligned scalar component · 09c9ed5b
      The compiler would wrongly reject an alignment clause larger than 8 on
      the component type of an array of scalars, which is valid albeit
      pathological.
      
      2019-07-03  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* layout.adb (Layout_Type): Do not set the component size of an
      	array with a scalar component if the component type is
      	overaligned.
      
      gcc/testsuite/
      
      	* gnat.dg/alignment14.adb: New testcase.
      
      From-SVN: r272968
      Eric Botcazou committed
    • [Ada] Make loop labels unique for front-end inlined calls · 6cbd53c2
      This patch transforms loop labels in the body of subprograms that are to
      be inlined by the front-end, to prevent accidental duplication of loop
      labels, which might make the resulting source illegal.
      
      ----
      Source program:
      ----
      package P is
         procedure Get_Rom_Addr_Offset
           with Inline_Always;
      end P;
      ----
      package body P is
         procedure Get_Rom_Addr_Offset is
            X : Integer;
         begin
            Main_Block :
            for I in 1 .. 10 loop
               X := 2;
               exit Main_Block when I > 4;
            other_loop:
               for J in character'('a') .. 'z' loop
                  if I < 5 then
                     exit Main_Block when J = 'k';
                  else
                     Exit Other_Loop;
                  end if;
               end loop other_loop;
            end loop Main_Block;
         end Get_Rom_Addr_Offset;
      
         procedure P2 is
         begin
            Main_Block :
            for I in 1 .. 1 loop
               Get_Rom_Addr_Offset;
            end loop Main_Block;
         end P2;
      end P;
      ----
      Command:
      
         gcc -c -gnatN -gnatd.u -gnatDG p.adb
      
      ----
      Output
      ----
      
      package body p is
      
         procedure p__get_rom_addr_offset is
            x : integer;
            other_loop : label
            main_block : label
         begin
            main_block : for i in 1 .. 10 loop
               x := 2;
               exit main_block when i > 4;
               other_loop : for j in 'a' .. 'z' loop
                  if i < 5 then
                     exit main_block when j = 'k';
                  else
                     exit other_loop;
                  end if;
               end loop other_loop;
            end loop main_block;
            return;
         end p__get_rom_addr_offset;
      
         procedure p__p2 is
            main_block : label
         begin
            main_block : for i in 1 .. 1 loop
               B6b : declare
                  x : integer;
                  other_loopL10b : label
                  main_blockL9b : label
               begin
                  main_blockL9b : for i in 1 .. 10 loop
                     x := 2;
                     exit main_blockL9b when i > 4;
                     other_loopL10b : for j in 'a' .. 'z' loop
                        if i < 5 then
                           exit main_blockL9b when j = 'k';
                        else
                           exit other_loopL10b;
                        end if;
                     end loop other_loopL10b;
                  end loop main_blockL9b;
               end B6b;
            end loop main_block;
            return;
         end p__p2;
      begin
         null;
      end p;
      
      2019-07-03  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* inline.adb (Make_Loop_Labels_Unique):  New procedure to modify
      	the source code of subprograms that are inlined by the
      	front-end, to prevent accidental duplication between loop labels
      	in the inlined code and the code surrounding the inlined call.
      
      From-SVN: r272967
      Ed Schonberg committed
    • [Ada] Update the section on resolving elaboration circularities · 438d9658
      2019-07-03  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Update
      	the section on resolving elaboration circularities to eliminate
      	certain combinations of switches which together do not produce
      	the desired effect and confuse users.
      	* gnat_ugn.texi: Regenerate.
      
      From-SVN: r272966
      Hristian Kirtchev committed
    • [Ada] Add a gnatbind option to generate C code · 97edd426
      2019-07-03  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* bindgen.adb (Gen_Main): Disable generation of reference to
      	Ada_Main_Program_Name for CCG.
      	* bindusg.adb (Display): Add -G to the command-line usage for
      	gnatbind.
      	* opt.ads (Generate_C_Code): Update comment.
      	* switch-b.adb (Scan_Binder_Switches): Add handling for -G.
      
      From-SVN: r272965
      Arnaud Charlet committed
    • [Ada] Do not consider inlined subprograms when generating C code · 81c10c3f
      2019-07-03  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* sem_ch7.adb (Has_Referencer): Do not consider inlined
      	subprograms when generating C code, which allows us to generate
      	static inline subprograms.
      
      From-SVN: r272964
      Arnaud Charlet committed
    • [Ada] Missing consistency check for constant modifier · 44f83ca4
      This patch fixes an issue whereby instantiations of generic packages
      were incorrectly allowed despite formal and actual subprograms not
      having matching declarations with anonymous constant access type
      parameters.
      
      ------------
      -- Source --
      ------------
      
      -- gen1.ads
      
      package Gen1 is
         generic
            with procedure View (IA : not null access constant Integer);
         procedure Dispatch (IA : access Integer);
      end;
      
      -- gen2.adb
      
      package body Gen1 is
         procedure Dispatch (IA : access Integer) is
         begin
            View (IA);
         end;
      end;
      
      -- bad1.ads
      
      with Gen1;
      package Bad1 is
         procedure Bad_View (IA : not null access Integer);
         procedure Bad_Dispatch is new Gen1.Dispatch (Bad_View);
      end;
      
      -- bad1.adb
      
      package body Bad1 is
         procedure Bad_View (IA : not null access Integer) is
         begin
            IA.all := IA.all + 1;
         end;
      end;
      
      -- gen2.ads
      
      package Gen2 is
         generic
            with procedure View (IA : access constant Integer);
         procedure Dispatch (IA : access Integer);
      end;
      
      -- gen2.adb
      
      package body Gen2 is
         procedure Dispatch (IA : access Integer) is
         begin
            View (IA);
         end;
      end;
      
      -- bad2.ads
      
      with Gen2;
      package Bad2 is
         procedure Bad_View (IA : access Integer);
         procedure Bad_Dispatch is new Gen2.Dispatch (Bad_View);
      end;
      
      -- bad2.adb
      
      package body Bad2 is
         procedure Bad_View (IA : access Integer) is
         begin
            IA.all := IA.all + 1;
         end;
      end;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gnatmake -q bad1.adb
      $ bad1.ads:4:04: instantiation error at gen1.ads:3
      $ bad1.ads:4:04: not mode conformant with declaration at line 3
      $ bad1.ads:4:04: constant modifier does not match
      $ gnatmake: "bad1.adb" compilation error
      $ gnatmake -q bad2.adb
      $ bad2.ads:4:04: instantiation error at gen2.ads:3
      $ bad2.ads:4:04: not mode conformant with declaration at line 3
      $ bad2.ads:4:04: constant modifier does not match
      $ gnatmake: "bad2.adb" compilation error
      
      2019-07-03  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* sem_ch6.adb (Check_Conformance): Add expression checking for
      	constant modifiers in anonymous access types (in addition to
      	"non-null" types) so that they are considered "matching" for
      	subsequent conformance tests.
      
      From-SVN: r272963
      Justin Squirek committed
    • [Ada] Clarify wording on documentation for No_Multiple_Elaboration · 3e1199e0
      2019-07-03  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
      	Clarify wording on No_Multiple_Elaboration.
      	* gnat_rm.texi: Regenerate.
      
      From-SVN: r272962
      Arnaud Charlet committed
    • [Ada] Spurious error on predicate of subtype in generic · f51e316c
      This patch fixes a spurious error on a dynamic predicate of a record
      subtype when the expression for the predicate includes a selected
      component that denotes a component of the subtype.
      
      2019-07-03  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_ch8.adb (Find_Selected_Component): If the prefix is the
      	current instance of a type or subtype, complete the resolution
      	of the name by finding the component of the type denoted by the
      	selector name.
      
      gcc/testsuite/
      
      	* gnat.dg/predicate4.adb, gnat.dg/predicate4_pkg.ads: New
      	testcase.
      
      From-SVN: r272961
      Ed Schonberg committed
    • [Ada] Document that boolean types with convention C now map to C99 bool · 07ec36ee
      2019-07-03  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_rm/interfacing_to_other_languages.rst (Interfacing to C):
      	Document that boolean types with convention C now map to C99 bool.
      	* gnat_rm.texi: Regenerate.
      
      From-SVN: r272960
      Eric Botcazou committed
    • [Ada] Exp_Attr: remove dead code · 4a51756a
      2019-07-03  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* exp_attr.adb (Expand_Min_Max_Attribute): Code cleanup:
      	removing code that it is now never executed in the CCG compiler
      	(dead code).
      
      From-SVN: r272959
      Javier Miranda committed
    • tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__SCANTEMP_ clause. · 2f6bb511
      	* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__SCANTEMP_
      	clause.
      	* tree.h (OMP_CLAUSE_DECL): Use OMP_CLAUSE__SCANTEMP_ instead of
      	OMP_CLAUSE__CONDTEMP_ as range's upper bound.
      	(OMP_CLAUSE__SCANTEMP__ALLOC, OMP_CLAUSE__SCANTEMP__CONTROL): Define.
      	* tree.c (omp_clause_num_ops, omp_clause_code_name): Add
      	OMP_CLAUSE__SCANTEMP_ entry.
      	(walk_tree_1): Handle OMP_CLAUSE__SCANTEMP_.
      	* tree-pretty-print.c (dump_omp_clause): Likewise.
      	* tree-nested.c (convert_nonlocal_omp_clauses,
      	convert_local_omp_clauses): Likewise.
      	* omp-general.h (struct omp_for_data): Add have_scantemp and
      	have_nonctrl_scantemp members.
      	* omp-general.c (omp_extract_for_data): Initialize them.
      	* omp-low.c (struct omp_context): Add scan_exclusive member.
      	(scan_omp_1_stmt): Don't unnecessarily mask gimple_omp_for_kind
      	result again with GF_OMP_FOR_KIND_MASK.  Initialize also
      	ctx->scan_exclusive.
      	(lower_rec_simd_input_clauses): Use ctx->scan_exclusive instead
      	of !ctx->scan_inclusive.
      	(lower_rec_input_clauses): Simplify gimplification of dtors using
      	gimplify_and_add.  For non-is_simd test OMP_CLAUSE_REDUCTION_INSCAN
      	rather than rvarp.  Handle OMP_CLAUSE_REDUCTION_INSCAN in worksharing
      	loops.  Don't add barrier for reduction_omp_orig_ref if
      	ctx->scan_??xclusive.
      	(lower_reduction_clauses): Don't do anything for ctx->scan_??xclusive.
      	(lower_omp_scan): Use ctx->scan_exclusive instead
      	of !ctx->scan_inclusive.  Handle worksharing loops with inscan
      	reductions.  Use new_vard != new_var instead of repeated
      	omp_is_reference calls.
      	(omp_find_scan, lower_omp_for_scan): New functions.
      	(lower_omp_for): Call lower_omp_for_scan for worksharing loops with
      	inscan reductions.
      	* omp-expand.c (expand_omp_scantemp_alloc): New function.
      	(expand_omp_for_static_nochunk): Handle fd->have_nonctrl_scantemp
      	and fd->have_scantemp.
      
      	* c-c++-common/gomp/scan-3.c (f1): Don't expect a sorry message.
      	* c-c++-common/gomp/scan-5.c (foo): Likewise.
      
      	* testsuite/libgomp.c++/scan-1.C: New test.
      	* testsuite/libgomp.c++/scan-2.C: New test.
      	* testsuite/libgomp.c++/scan-3.C: New test.
      	* testsuite/libgomp.c++/scan-4.C: New test.
      	* testsuite/libgomp.c++/scan-5.C: New test.
      	* testsuite/libgomp.c++/scan-6.C: New test.
      	* testsuite/libgomp.c++/scan-7.C: New test.
      	* testsuite/libgomp.c++/scan-8.C: New test.
      	* testsuite/libgomp.c/scan-1.c: New test.
      	* testsuite/libgomp.c/scan-2.c: New test.
      	* testsuite/libgomp.c/scan-3.c: New test.
      	* testsuite/libgomp.c/scan-4.c: New test.
      	* testsuite/libgomp.c/scan-5.c: New test.
      	* testsuite/libgomp.c/scan-6.c: New test.
      	* testsuite/libgomp.c/scan-7.c: New test.
      	* testsuite/libgomp.c/scan-8.c: New test.
      
      From-SVN: r272958
      Jakub Jelinek committed
    • gimplify.c (gimplify_scan_omp_clauses): For inscan reductions on worksharing… · 83eb9522
      gimplify.c (gimplify_scan_omp_clauses): For inscan reductions on worksharing loop propagate it as shared clause to...
      
      	* gimplify.c (gimplify_scan_omp_clauses): For inscan reductions
      	on worksharing loop propagate it as shared clause to containing
      	combined parallel.
      
      	* c-omp.c (c_omp_split_clauses): Put OMP_CLAUSE_REDUCTION_INSCAN
      	clauses on OMP_FOR rather than OMP_PARALLEL when OMP_FOR is combined
      	with OMP_PARALLEL.
      
      	* c-c++-common/gomp/scan-5.c: New test.
      
      From-SVN: r272957
      Jakub Jelinek committed
    • omp-expand.c (expand_omp_for_static_nochunk, [...]): For nowait worksharing loop… · 1a39b3d3
      omp-expand.c (expand_omp_for_static_nochunk, [...]): For nowait worksharing loop with conditional lastprivate clause(s)...
      
      	* omp-expand.c (expand_omp_for_static_nochunk,
      	expand_omp_for_static_chunk): For nowait worksharing loop with
      	conditional lastprivate clause(s), emit GOMP_loop_end_nowait call
      	at the end.
      
      	* c-c++-common/gomp/lastprivate-conditional-5.c: New test.
      
      From-SVN: r272956
      Jakub Jelinek committed
    • compiler: rework type and package tracking in exporter · 61a02d1e
          
          Revamps the way the exporter tracks exported types and imported
          packages that need to be mentioned in the export data.
          
          The previous implementation wasn't properly handling the case where an
          exported non-inlinable function refers to an imported type whose
          method set includes an inlinable function whose body makes a call to a
          function in another package that's not directly used in the original
          package.
          
          This patch integrates together two existing traversal helper classes,
          "Collect_references_from_inline" and "Find_types_to_prepare" into a
          single helper "Collect_export_references", so as to have common/shared
          code that looks for indirectly imported packages.
          
          Fixes golang/go#32778
          
          Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183850
      
      From-SVN: r272955
      Ian Lance Taylor committed
    • re PR testsuite/91065 (gcc.dg/plugin/start_unit_plugin.c uses ggc memory without… · 5935baf5
      re PR testsuite/91065 (gcc.dg/plugin/start_unit_plugin.c uses ggc memory without registering a root_tab)
      
              PR testsuite/91065
              * testsuite/gcc.dg/plugin/start_unit_plugin.c: Register a root tab
              to reference fake_var.
      
      From-SVN: r272954
      Joern Rennecke committed
    • Daily bump. · d332da4f
      From-SVN: r272953
      GCC Administrator committed
  2. 02 Jul, 2019 21 commits
  3. 01 Jul, 2019 3 commits