Skip to content

Commit 272d0cc

Browse files
authored
Merge pull request #58 from rust-lang/fix/remove-global
Fix for global variable removal
2 parents 6514edc + a695694 commit 272d0cc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

gcc/jit/jit-playback.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,6 @@ global_new_decl (location *loc,
789789
type_tree);
790790

791791
TREE_PUBLIC (inner) = (kind != GCC_JIT_GLOBAL_INTERNAL);
792-
if (removed)
793-
TREE_ASM_WRITTEN (inner) = 1;
794-
795792

796793
int will_be_init = flags & (GLOBAL_VAR_FLAGS_WILL_BE_RVAL_INIT |
797794
GLOBAL_VAR_FLAGS_WILL_BE_BLOB_INIT);
@@ -854,9 +851,10 @@ set_variable_string_attribute (
854851

855852
playback::lvalue *
856853
playback::context::
857-
global_finalize_lvalue (tree inner)
854+
global_finalize_lvalue (tree inner, bool removed)
858855
{
859-
m_globals.safe_push (inner);
856+
if (!removed)
857+
m_globals.safe_push (inner);
860858

861859
return new lvalue (this, inner);
862860
}
@@ -878,7 +876,7 @@ new_global (location *loc,
878876
tree inner =
879877
global_new_decl (loc, kind, type, name, flags, attributes, readonly, removed);
880878

881-
return global_finalize_lvalue (inner);
879+
return global_finalize_lvalue (inner, removed);
882880
}
883881

884882
void
@@ -1061,7 +1059,7 @@ new_global_initialized (location *loc,
10611059
/* Compare with 'store_init_value' c-typeck.cc:7555. */
10621060
DECL_INITIAL (inner) = ctor;
10631061

1064-
return global_finalize_lvalue (inner);
1062+
return global_finalize_lvalue (inner, removed);
10651063
}
10661064

10671065
/* Implementation of the various

gcc/jit/jit-playback.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class context : public log_user
367367
bool readonly,
368368
bool removed);
369369
lvalue *
370-
global_finalize_lvalue (tree inner);
370+
global_finalize_lvalue (tree inner, bool removed);
371371

372372
private:
373373

0 commit comments

Comments
 (0)