Mercury Bugs - mercury
View Issue Details
0000468mercuryBugpublic2018-08-19 13:052018-09-03 12:29
Reporterwangp 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000468: free argument packed with other argument uses uninitialised variable
DescriptionIn high-level C grades, the goal from packed_arg_partial_inst.m

        X = struct(42, _, yes, orange, _, _, _),

compiles to

        {
          MR_Word TypeCtorInfo_13_13;
          MR_Integer Var_10;
          MR_Word Var_11;
          MR_Word Var_12;
          MR_Word Var_6;
          MR_Word Var_7;
          MR_Word Var_8;
          MR_String Var_9;

          Var_10 = (MR_Integer) 42;
          Var_11 = (MR_Integer) 1;
          Var_12 = (MR_Integer) 2;
          {
            MR_Word base;
            base = (MR_Word) MR_new_object(MR_Word, ((MR_Integer) 3 * sizeof(MR_Word)), NULL, NULL);
            (env_ptr)->packed_arg_partial_inst__foo_2_p_0_env_0__X_5 = base;
            MR_hl_field(MR_mktag(0), base, 0) = ((MR_Box) (Var_10));
            MR_hl_field(MR_mktag(0), base, 1) = (MR_Box)
        (((((MR_Unsigned) (Var_6) << (MR_Integer) 6)) |
         (((((MR_Unsigned) (Var_11) << (MR_Integer) 5)) |
         (((((MR_Unsigned) (Var_12) << (MR_Integer) 3)) |
         (((((MR_Unsigned) (Var_7) << (MR_Integer) 2)) |
         (MR_Unsigned) (Var_8)))))))));
            MR_hl_field(MR_mktag(0), base, 2) = NULL;
          }

where Var_6, Var_7, Var_8 are used without being initialised.
TagsNo tags attached.
Attached Files

Notes
(0001008)
zs   
2018-08-19 15:24   
I am working on a change that involves that code anyway.
(0001009)
zs   
2018-09-03 12:29   
Fix committed 2018 sep 3.

Issue History
2018-08-19 13:05wangpNew Issue
2018-08-19 15:22zsAssigned To => zs
2018-08-19 15:22zsStatusnew => assigned
2018-08-19 15:24zsNote Added: 0001008
2018-09-03 12:29zsStatusassigned => resolved
2018-09-03 12:29zsResolutionopen => fixed
2018-09-03 12:29zsNote Added: 0001009