@@ -24,7 +24,7 @@ extern Core PDL; /* for PDL_TYPENAME */
2424 PDLDEBUG_f(printf("VTOD " #func " child=%p turning off datachanged, before=", child); pdl_dump_flags_fixspace(child->state, 0, PDL_FLAGS_PDL)); \
2525 if (is_fwd) child->state &= ~PDL_PARENTDATACHANGED; \
2626 if (child && (child->state & PDL_BADVAL)) \
27- pdl_propagate_badflag (child, !!(child->state & PDL_BADVAL)); \
27+ pdl_propagate_badflag_dir (child, !!(child->state & PDL_BADVAL), is_fwd, 1 ); \
2828 } \
2929 } while (0)
3030#define READDATA (trans ) VTABLE_OR_DEFAULT(PDL_ACCUMERROR, trans, 1, readdata, readdata_affine)
@@ -1029,30 +1029,45 @@ pdl_error pdl_sever(pdl *src)
10291029 return PDL_err ;
10301030}
10311031
1032- #define PDL_MAYBE_PROPAGATE_BADFLAG (t , newval ) \
1033- for ( i = 0; i < (t)->vtable->npdls; i++ ) { \
1034- pdl *tpdl = (t)->pdls[i]; \
1035- /* make sure we propagate if changed */ \
1036- if (!!newval != !!(tpdl -> state & PDL_BADVAL )) \
1037- pdl_propagate_badflag ( tpdl , newval ); \
1038- }
1039-
1032+ #define PDL_MAYBE_PROPAGATE_BADFLAG (t , newval , is_fwd ) do { \
1033+ pdl_transvtable *vtable = (t)->vtable; \
1034+ PDL_Indx i, istart = is_fwd ? vtable->nparents : 0, iend = is_fwd ? vtable->npdls : vtable->nparents; \
1035+ for (i = istart; i < iend; i++) { \
1036+ pdl *tpdl = (t)->pdls[i]; \
1037+ /* make sure we propagate if changed */ \
1038+ if (!!newval != !!(tpdl -> state & PDL_BADVAL )) \
1039+ pdl_propagate_badflag_dir (tpdl , newval , is_fwd , recurse_count + 1 ); \
1040+ } \
1041+ } while (0 )
10401042/* newval = 1 means set flag, 0 means clear it */
1041- void pdl_propagate_badflag ( pdl * it , int newval ) {
1042- PDLDEBUG_f (printf ("pdl_propagate_badflag pdl=%p newval=%d\n" , it , newval ));
1043- PDL_Indx i , j ;
1044- if (newval )
1045- it -> state |= PDL_BADVAL ;
1046- else
1047- it -> state &= ~PDL_BADVAL ;
1043+ pdl_error pdl_propagate_badflag_dir (pdl * it , int newval , char is_fwd , int recurse_count ) {
1044+ PDL_RECURSE_CHECK (recurse_count );
1045+ PDLDEBUG_f (printf ("pdl_propagate_badflag_dir pdl=%p newval=%d is_fwd=%d\n" , it , newval , (int )is_fwd ));
1046+ pdl_error PDL_err = {0 , NULL , 0 };
1047+ if (newval )
1048+ it -> state |= PDL_BADVAL ;
1049+ else
1050+ it -> state &= ~PDL_BADVAL ;
1051+ if (!is_fwd ) {
10481052 if (it -> trans_parent )
1049- PDL_MAYBE_PROPAGATE_BADFLAG (it -> trans_parent , newval )
1053+ PDL_MAYBE_PROPAGATE_BADFLAG (it -> trans_parent , newval , 0 );
1054+ } else {
1055+ PDL_Indx j ;
1056+ if (
1057+ (it -> state & (PDL_OPT_VAFFTRANSOK |PDL_ALLOCATED )) == PDL_OPT_VAFFTRANSOK && /* pure vaff */
1058+ newval /* expansive - if slice gets badflag, whole does */
1059+ )
1060+ pdl_propagate_badflag_dir (it -> vafftrans -> from , newval , 1 , recurse_count + 1 );
10501061 for (j = 0 ; j < it -> ntrans_children_allocated ; j ++ ) {
10511062 pdl_trans * trans = it -> trans_children [j ];
10521063 if (!trans ) continue ;
1053- trans -> bvalflag = !!newval ;
1054- PDL_MAYBE_PROPAGATE_BADFLAG (trans , newval )
1064+ PDL_MAYBE_PROPAGATE_BADFLAG (trans , newval , 1 );
10551065 }
1066+ }
1067+ return PDL_err ;
1068+ }
1069+ void pdl_propagate_badflag (pdl * it , int newval ) { /* CORE21 get rid */
1070+ return ; /* nerfed as replaced with directional version */
10561071}
10571072
10581073/*CORE21 use pdl_error, replace fprintf*/
0 commit comments