- changed status to resolved
PreSync circumvents scoping of Cactus grid functions for C/C++ functions.
As implemented, the header generated for DECLARE_CCTK_ARGUMENTS_func does not check to see whether the thorn has access to a GF that it wants to read or write. In Fortran, this will lead to a compile time error, but in C/C++, the header will simply grant access to the variable.
Comments (9)
-
reporter -
- changed status to open
Should be made an error before ET_2020_11
-
- changed milestone to ET_2020_11
-
Related to #2468
-
reporter So the only thing that needs to be done here is convert warnings to errors. Correct?
diff --git a/lib/sbin/rdwr.pl b/lib/sbin/rdwr.pl index 24b3cf12..e1be427c 100644 --- a/lib/sbin/rdwr.pl +++ b/lib/sbin/rdwr.pl @@ -527,7 +527,7 @@ sub create_macros $hint = "Check variable or group '${th}::$full_var' and verify ". "correct implementation/thorn name and variable name.'"; } - &CST_error(1, "Error in read/write declaration of '${th}::$full_var' for '$nm' in schedule." + &CST_error(0, "Error in read/write declaration of '${th}::$full_var' for '$nm' in schedule." ,$hint, $errline, $ccl_file); next; } @@ -536,7 +536,7 @@ sub create_macros # the variable type... if($vtype eq "CCTK_") { my $hint = "Bad variable group name '$full_var' at $errline"; - &CST_error(1, "Error in read/write declaration $nm schedule. Check variable or group '$full_var'" . + &CST_error(0, "Error in read/write declaration $nm schedule. Check variable or group '$full_var'" . ' and verify correct implementation/thorn name and variable name.' ,$hint, $errline, $ccl_file); next; @@ -569,7 +569,7 @@ sub create_macros if(!defined($decls->{$full_var})) { my $line = $reads_writes->{$namekey}->{$th}->{$full_var}->{line}; my $hint = "Check access of variable. Maybe add an inherits clause to your interface.ccl"; - &CST_error(1, "No access to variable '${th}::$ifull_var'" + &CST_error(0, "No access to variable '${th}::$ifull_var'" ,$hint, $line, $ccl_file); } $$data .= qq($vtype $const * restrict const $ifull_var __attribute__((__unused__)) = (($vtype *) CCTKi_VarDataPtrI(cctkGH, $timelevel, CCTK_JOIN_TOKENS(cctki_vi_, CCTK_THORN).$ivar));; /* group $group_register */\\\n); @@ -584,7 +584,7 @@ sub create_macros if(!defined($decls->{$full_var})) { my $line = $reads_writes->{$namekey}->{$th}->{$full_var}->{line}; my $hint = "Check access of variable. Maybe add an inherits clause to your interface.ccl"; - &CST_error(1, "No access to variable '${th}::$ifull_var'" + &CST_error(0, "No access to variable '${th}::$ifull_var'" ,$hint, $line, $ccl_file); } $$data .= qq($vtype $const * restrict const $ifull_var __attribute__((__unused__)) = (($vtype *) CCTKi_VarDataPtrI(cctkGH, $timelevel, CCTK_JOIN_TOKENS(cctki_vi_, CCTK_THORN).$ivar));; /* TL: $namekey --> $timelevel $group_register*/\\\n);
-
I believe so, yes. And check that these are actually warnings that we want to be errors. I had hoped that we had created a ticket or list of changes for this while adding PreSync to master (there was at least one ticket about turning the original errors into warnings but I cannot really find it anymore).
This was planned to happen very shortly after the Turing release but with the gcc/gfortran-10 mess it was forgotten.
#2468 lists a couple more candidates.
-
reporter @Roland Haas I think the above are the changes related to the subject of this ticket.
-
I agree. I should have been more explicit in the mini-review: Please apply.
-
reporter - changed status to resolved
Fixed in 8407ee10 of https://bitbucket.org/cactuscode/cactus.git
- Log in to comment
Fixed in 6c515e8710bed22b75f90f3033bf460204f5db1f of https://bitbucket.org/cactuscode/cactus.git
Circumventing access is a level 1 error in this fix. This should be upgraded to level 0 before the next release.