Skip to content
Snippets Groups Projects
Commit 7ccdab06 authored by chrg's avatar chrg
Browse files

Semi reasonable refactor

parent d0bdb866
No related branches found
No related tags found
No related merge requests found
Showing
with 366 additions and 195 deletions
......@@ -185,27 +185,79 @@ keepAll :: SpecifierFilter
keepAll = SpecifierFilter{sfKeepStatic = True}
{- | Update the CDeclarationSpecifier's to match the context. Specifically, update
the typedefs and the structs. Alos return a base type.
the typedefs and the structs. Also return a base type.
-}
updateCDeclarationSpecifiers ::
( MonadState Context m
, MonadPlus m
forall m.
( MonadReduce Lab m
, HasCallStack
) =>
SpecifierFilter ->
Context ->
[C.CDeclarationSpecifier C.NodeInfo] ->
m (Voidable, [C.CDeclarationSpecifier C.NodeInfo])
updateCDeclarationSpecifiers sf spec = do
ctx <- get
spec' <- concat <$> mapM (updateSpec ctx) spec
bt <- baseType ctx spec'
pure (bt, spec')
Maybe (m (Voidable, [C.CDeclarationSpecifier C.NodeInfo]))
updateCDeclarationSpecifiers sf ctx spec = do
bt <- typeFromCDeclarationSpecifiers ctx spec
specfn <- mapM updateSpec spec
Just do
spec' <- sequence specfn
pure (bt, concat spec')
where
baseType ::
(MonadPlus m) =>
updateSpec ::
C.CDeclarationSpecifier C.NodeInfo ->
Maybe (m [C.CDeclarationSpecifier C.NodeInfo])
updateSpec a = case a of
C.CTypeSpec t -> case t of
C.CSUType (C.CStruct st (Just i) (Just declrs) attr x) b -> do
fields <- case lookupStruct ctx i of
ISDelete -> empty
ISDeclared _ -> empty
ISKeep s -> do
pure $ structTypeFields s
Just do
declrs' <- filterStruct fields declrs
pure [C.CTypeSpec (C.CSUType (C.CStruct st (Just i) (Just declrs') attr x) b)]
C.CTypeDef idx _ -> do
case Map.lookup idx . typeDefs $ ctx of
Just (ITKeep _) -> Just $ pure [C.CTypeSpec t]
Just (ITInline _ res) -> Just $ pure res
Just ITDelete -> Nothing
Nothing -> error ("could not find typedef: " <> show idx)
_ow -> Just $ pure [C.CTypeSpec t]
C.CStorageSpec (C.CStatic _) -> Just $ pure [a | sfKeepStatic sf]
C.CFunSpec (C.CInlineQual _) -> Just $ pure [a | sfKeepStatic sf]
_ow -> Just $ pure [a]
filterStruct ::
[(a1, Maybe a2)] ->
[C.CDeclaration C.NodeInfo] ->
m [C.CDeclaration C.NodeInfo]
filterStruct fields declrs =
flip evalStateT fields do
declrs' <- forM declrs $ \case
C.CDecl spec2 items l -> runMaybeT do
items' <- forM items $ \case
C.CDeclarationItem (C.CDeclr mid dd sl attr ni2) enit ni1 -> runMaybeT do
_ <- liftMaybe =<< state (\((_, t) : tps) -> (t, tps))
(_, dd') <- evalStateT (updateCDerivedDeclarators Void (repeat True) dd) ctx
pure (C.CDeclarationItem (C.CDeclr mid dd' sl attr ni2) enit ni1)
a' -> notSupportedYet a' l
(_, spec2') <- joinLiftMaybe (updateCDeclarationSpecifiers keepAll ctx spec2)
let items'' = catMaybes items'
guard $ not (List.null items'')
pure (C.CDecl spec2' items'' l)
a' -> notSupportedYet' a'
pure $ catMaybes declrs'
typeFromCDeclarationSpecifiers ::
forall m.
( MonadPlus m
, HasCallStack
) =>
Context ->
[C.CDeclarationSpecifier C.NodeInfo] ->
m Voidable
baseType ctx =
typeFromCDeclarationSpecifiers ctx =
liftMaybe
. exactlyOne
. map \case
......@@ -270,7 +322,7 @@ updateCDeclarationSpecifiers sf spec = do
a -> notSupportedYet (void a) ni
a -> notSupportedYet' a
typeOf spec2 decl = baseType ctx spec2 >>= extendTypeWith decl
typeOf spec2 decl = typeFromCDeclarationSpecifiers ctx spec2 >>= extendTypeWith decl
extendTypeWith (C.CDeclr _ dd _ _ _) t =
foldr applyDD (Just t) dd
......@@ -289,53 +341,66 @@ updateCDeclarationSpecifiers sf spec = do
[C.CDecl [C.CTypeSpec (C.CVoidType _)] [] _] -> VoidParams
rst -> flip Params varadic $ flip map rst \case
C.CDecl spec' [] _ ->
nonVoid <$> baseType ctx spec'
nonVoid <$> typeFromCDeclarationSpecifiers ctx spec'
C.CDecl spec' [C.CDeclarationItem decl _ _] _ ->
nonVoid <$> typeOf spec' decl
a -> notSupportedYet' a
updateSpec ctx a = case a of
C.CTypeSpec t -> case t of
C.CSUType (C.CStruct st (Just i) (Just declrs) attr x) b -> do
fields <- case lookupStruct ctx i of
ISDelete -> empty
ISDeclared _ -> empty
ISKeep s -> do
pure $ structTypeFields s
let declrs' :: [C.CDeclaration C.NodeInfo] = filterStruct ctx fields declrs
pure [C.CTypeSpec (C.CSUType (C.CStruct st (Just i) (Just declrs') attr x) b)]
C.CTypeDef idx _ -> do
case Map.lookup idx . typeDefs $ ctx of
Just (ITKeep _) -> pure [C.CTypeSpec t]
Just (ITInline _ res) -> pure res
Just ITDelete -> mzero
Nothing -> error ("could not find typedef: " <> show idx)
_ow -> pure [C.CTypeSpec t]
C.CStorageSpec (C.CStatic _) -> pure [a | sfKeepStatic sf]
C.CFunSpec (C.CInlineQual _) -> pure [a | sfKeepStatic sf]
_ow -> pure [a]
typeFromCDerivedDeclarators ::
forall m.
( MonadPlus m
) =>
Voidable ->
Context ->
[C.CDerivedDeclarator C.NodeInfo] ->
m Voidable
typeFromCDerivedDeclarators bt ctx dd =
foldM applyDD bt (reverse dd)
where
applyDD ::
(r ~ Voidable) =>
r ->
C.CDerivedDeclarator C.NodeInfo ->
m r
applyDD t d = case d of
C.CPtrDeclr _ _ -> do
pure (NonVoid . TPointer $ t)
C.CArrDeclr{} -> do
pure (NonVoid . TPointer $ t)
C.CFunDeclr params _ ni -> do
case params of
C.CFunParamsNew params' varadic -> do
tp <- findParams varadic params'
let t' = NonVoid $ TFun (FunType t tp)
pure t'
b -> notSupportedYet b ni
filterStruct ctx fields declrs =
flip evalState fields do
declrs' <- forM declrs $ \case
C.CDecl spec2 items l -> runMaybeT do
items' <- forM items $ \case
C.CDeclarationItem (C.CDeclr mid dd sl attr ni2) enit ni1 -> runMaybeT do
_ <- liftMaybe =<< state (\((_, t) : tps) -> (t, tps))
(_, dd') <- liftMaybe (evalStateT (updateCDerivedDeclarators Void (repeat True) dd) ctx)
pure (C.CDeclarationItem (C.CDeclr mid dd' sl attr ni2) enit ni1)
a' -> notSupportedYet a' l
(_, spec2') <- liftMaybe (evalStateT (updateCDeclarationSpecifiers keepAll spec2) ctx)
let items'' = catMaybes items'
guard $ not (List.null items'')
pure (C.CDecl spec2' items'' l)
a' -> notSupportedYet' a'
pure $ catMaybes declrs'
findParams ::
Bool ->
[C.CDeclaration C.NodeInfo] ->
m Params
findParams varadic decls = case decls of
[C.CDecl [C.CTypeSpec (C.CVoidType _)] [] _] ->
pure VoidParams
_ow -> do
result <-
forM decls $ \case
C.CDecl spec items ni -> do
bt' <- typeFromCDeclarationSpecifiers ctx spec
case items of
[] -> do
pure $ nonVoid bt'
[C.CDeclarationItem (C.CDeclr _ dd2 Nothing [] _) Nothing _] -> do
(nonVoid -> t) <- typeFromCDerivedDeclarators bt' ctx dd2
pure t
_ow -> notSupportedYet items ni
a -> notSupportedYet' a
pure (Params (map Just result) varadic)
updateCDerivedDeclarators ::
forall m.
( MonadState Context m
, MonadPlus m
, MonadReduce (String, C.Position) m
) =>
Voidable ->
[Bool] ->
......@@ -352,12 +417,18 @@ updateCDerivedDeclarators bt ff dd = do
applyDD (t, dd') d = case d of
C.CPtrDeclr _ _ -> do
pure (NonVoid . TPointer $ t, d : dd')
C.CArrDeclr{} ->
pure (NonVoid . TPointer $ t, d : dd')
C.CArrDeclr r as ni -> do
d' <- case as of
C.CArrSize _ _ -> do
-- b <- check ("remove array size", C.posOf ni)
let b = False
pure $ if b then C.CArrDeclr r (C.CNoArrSize False) ni else d
_ -> pure d
pure (NonVoid . TPointer $ t, d' : dd')
C.CFunDeclr params arr ni -> do
case params of
C.CFunParamsNew params' varadic -> do
(tp, params'') <- state (runState (findParams varadic params'))
(tp, params'') <- findParams varadic params'
let t' = NonVoid $ TFun (FunType t tp)
pure (t', C.CFunDeclr (C.CFunParamsNew params'' varadic) arr ni : dd')
b -> notSupportedYet b ni
......@@ -365,7 +436,7 @@ updateCDerivedDeclarators bt ff dd = do
findParams ::
Bool ->
[C.CDeclaration C.NodeInfo] ->
State Context (Params, [C.CDeclaration C.NodeInfo])
m (Params, [C.CDeclaration C.NodeInfo])
findParams varadic decls = case decls of
[C.CDecl [C.CTypeSpec (C.CVoidType _)] [] _] ->
pure (VoidParams, decls)
......@@ -376,7 +447,8 @@ updateCDerivedDeclarators bt ff dd = do
keep <- state (\(t : tps) -> (t, tps))
lift . runMaybeT $ do
markDeleted items
(bt', spec') <- updateCDeclarationSpecifiers keepAll spec
ctx <- get
(bt', spec') <- join (liftMaybe $ updateCDeclarationSpecifiers keepAll ctx spec)
(t, items') <- case items of
[] -> do
guard keep
......@@ -401,6 +473,9 @@ updateCDerivedDeclarators bt ff dd = do
Nothing -> (Nothing, [])
pure (Params ts varadic, concat decls')
joinLiftMaybe :: (MonadPlus m) => Maybe (m a) -> m a
joinLiftMaybe = join . liftMaybe
reduceCExternalDeclaration ::
(HasCallStack, MonadReduce Lab m) =>
C.CExternalDeclaration C.NodeInfo ->
......@@ -421,11 +496,12 @@ reduceCExternalDeclaration r = case r of
let keepStatic = maybe True funIsStatic mfun
-- TODO handle this edgecase (struct declared in function declaration)
_ <- reduceStructDeclaration spec
(bt, spec') <- updateCDeclarationSpecifiers keepAll{sfKeepStatic = keepStatic} spec
((nonVoid -> t@(TFun (FunType rt _)), dd'), ctx') <-
runStateT
(updateCDerivedDeclarators bt (fromMaybe (repeat True) (mfun >>= funParams)) dd)
ctx
ctx' <- get
(bt, spec') <- joinLiftMaybe $ updateCDeclarationSpecifiers keepAll{sfKeepStatic = keepStatic} ctx' spec
((t', dd'), ctx'') <- runStateT (updateCDerivedDeclarators bt (fromMaybe (repeat True) (mfun >>= funParams)) dd) ctx'
let t@(TFun (FunType rt _)) = nonVoid t'
case mfun of
Just fun -> do
......@@ -439,7 +515,7 @@ reduceCExternalDeclaration r = case r of
stmt' <-
reduceCStatementOrEmptyBlock stmt StmtContext{stmtLabels = labs, stmtInLoop = False} $
ctx'{returnType = rt}
ctx''{returnType = rt}
pure . C.CFDefExt $
C.CFunDef spec' (C.CDeclr mid dd' Nothing [] ni2) [] stmt' ni
......@@ -466,7 +542,8 @@ reduceCExternalDeclaration r = case r of
modify' (addTypeDef ix ITDelete)
keep <- reduceStructDeclaration rst
(bt, rst') <- updateCDeclarationSpecifiers keepAll rst
ctx <- get
(bt, rst') <- joinLiftMaybe $ updateCDeclarationSpecifiers keepAll ctx rst
(t, _) <- updateCDerivedDeclarators bt (repeat True) dd
......@@ -499,7 +576,8 @@ reduceCExternalDeclaration r = case r of
then not <$> check ("make declaration non-static", C.posOf ni)
else return False
(bt, spec') <- updateCDeclarationSpecifiers keepAll{sfKeepStatic = isStatic} spec
ctx' <- get
(bt, spec') <- joinLiftMaybe $ updateCDeclarationSpecifiers keepAll{sfKeepStatic = isStatic} ctx' spec
-- Try to remove each declaration item
items' <-
flip collect items \case
......@@ -508,12 +586,12 @@ reduceCExternalDeclaration r = case r of
C.CFunDeclr{} : _ -> do
mfun <- case mid of
Just fid ->
Just <$> liftMaybe (lookupFunction ctx fid)
Just <$> liftMaybe (lookupFunction ctx' fid)
Nothing ->
pure Nothing
let ff = fromMaybe (repeat True) (mfun >>= funParams)
(nonVoid -> t, dd') <-
evalStateT (updateCDerivedDeclarators bt ff dd) ctx
updateCDerivedDeclarators bt ff dd
case mid of
Just fid -> do
modify' (addInlineExpr fid IEDelete)
......@@ -522,12 +600,12 @@ reduceCExternalDeclaration r = case r of
Nothing -> do
exceptIf ("remove function", C.posOf ni2)
pure (C.CDeclarationItem (C.CDeclr mid dd' Nothing [] ni2) einit size)
_dd -> reduceCDeclarationItem bt di
_dd -> reduceCDeclarationItem bt True di
a -> notSupportedYet (a $> ()) ni
-- Somtimes we just declare a struct or a typedef.
when (not keep && List.null items') do
guard (AllowEmptyDeclarations `isIn` ctx || List.null items)
guard (AllowEmptyDeclarations `isIn` ctx' || List.null items)
exceptIf ("remove declaration", C.posOf ni)
pure $ C.CDeclExt $ C.CDecl spec' items' ni
......@@ -611,9 +689,10 @@ reduceStructDeclaration =
where
structField sid = \case
C.CDecl spec items ni -> do
res <- runMaybeT $ updateCDeclarationSpecifiers keepAll spec
case res of
Just (bt, spec') -> do
ctx <- get
case updateCDeclarationSpecifiers keepAll ctx spec of
Just fn -> do
(bt, spec') <- fn
(fields, items') <- flip mapAndUnzipM items \case
(C.CDeclarationItem (C.CDeclr mid dd Nothing [] ni3) ini ni2) -> do
let fid = fromMaybe (error "all struct fields should be named") mid
......@@ -641,28 +720,35 @@ reduceCDeclarationItem ::
, MonadPlus m
) =>
Voidable ->
Bool ->
C.CDeclarationItem C.NodeInfo ->
m (C.CDeclarationItem C.NodeInfo)
reduceCDeclarationItem bt = \case
reduceCDeclarationItem bt nullable = \case
di@(C.CDeclarationItem (C.CDeclr mid dd Nothing [] ni) einit Nothing) -> do
ctx <- get
case mid of
Just vid -> do
(nonVoid -> t, dd') <- evalStateT (updateCDerivedDeclarators bt (repeat True) dd) ctx
(nonVoid -> t, dd') <- updateCDerivedDeclarators bt (repeat True) dd
einit' <- case einit of
Just einit2 -> do
(einit', inlinable) <- reduceCInitializer t einit2 ctx
case inlinable of
ctx <- get
einit' <-
whenSplit
nullable
("remove initialization", C.posOf ni)
(pure Nothing)
(Just <$> reduceCInitializer t einit2 ctx)
case getInlinable (fromMaybe einit2 einit') of
Just e' -> do
modify' (addInlineExpr vid (IEInline e'))
exceptIf ("inline variable " <> C.identToString vid, C.posOf ni)
Nothing -> do
exceptIf ("delete variable", C.posOf ni)
pure (Just einit')
pure einit'
Nothing -> do
exceptIf ("delete uninitilized variable", C.posOf ni)
initialize <- gets (InitializeVariables `isIn`)
whenSplit
(t == TNum)
(t == TNum && initialize)
("initilize variable", C.posOf ni)
(pure . Just $ C.CInitExpr zeroExpr C.undefNode)
(pure Nothing)
......@@ -674,53 +760,49 @@ reduceCDeclarationItem bt = \case
pure di
a -> notSupportedYet a C.undefNode
getInlinable :: C.CInitializer C.NodeInfo -> Maybe C.CExpr
getInlinable = \case
C.CInitExpr e _ -> case e of
C.CConst _ -> Just e
C.CVar _ _ -> Just e
_ -> Nothing
C.CInitList _ _ -> Nothing
reduceCInitializer ::
(MonadReduce Lab m) =>
Type ->
C.CInitializer C.NodeInfo ->
Context ->
m (C.CInitializer C.NodeInfo, Maybe C.CExpr)
m (C.CInitializer C.NodeInfo)
reduceCInitializer t einit ctx = case einit of
C.CInitExpr e ni2 -> do
let me = reduceCExpr e (exactly t) ctx
case (me, t) of
(Just es, _) -> do
e' <- es
pure
( C.CInitExpr e' ni2
, case e' of
C.CConst _ -> Just e'
C.CVar _ _ -> Just e'
_ow -> Nothing
)
pure $ C.CInitExpr e' ni2
(Nothing, TVector n _) -> do
let items' = [([], C.CInitExpr zeroExpr ni2) | _ <- replicate n ()]
pure (C.CInitList (C.CInitializerList items') ni2, Nothing)
pure $ C.CInitList (C.CInitializerList items') ni2
(Nothing, _) -> do
let e' = zeroExpr
pure
( C.CInitExpr e' ni2
, case e' of
C.CConst _ -> Just e'
C.CVar _ _ -> Just e'
_ow -> Nothing
)
pure $ C.CInitExpr e' ni2
C.CInitList (C.CInitializerList items) ni2 -> do
items' <- case t of
TStruct stct -> do
let fields = fieldsOfStruct ctx stct
let i'' = catMaybes $ zipWith (\(_, t') i -> (i,) <$> t') fields items
forM i'' \((p, r), t') -> do
(r', _) <- reduceCInitializer t' r ctx
r' <- reduceCInitializer t' r ctx
pure (p, r')
TPointer (NonVoid t') -> do
forM items \(p, r) -> do
(r', _) <- reduceCInitializer t' r ctx
r' <- reduceCInitializer t' r ctx
pure (p, r')
_ow ->
-- "Unexpected type of init list: " <> show t <> " at " <> show (C.posOf ni2)
pure items
pure (C.CInitList (C.CInitializerList items') ni2, Nothing)
pure $ C.CInitList (C.CInitializerList items') ni2
reduceCCompoundBlockItem ::
(MonadReduce Lab m, HasCallStack) =>
......@@ -749,10 +831,10 @@ reduceCCompoundBlockItem lab r = do
markDeleted items
keep <- reduceStructDeclaration spec
(bt, spec') <- updateCDeclarationSpecifiers keepAll spec
(bt, spec') <- joinLiftMaybe $ updateCDeclarationSpecifiers keepAll ctx spec
-- Try to remove each declaration item
items' <- collect (reduceCDeclarationItem bt) items
items' <- collect (reduceCDeclarationItem bt False) items
-- Somtimes we just declare a struct or a typedef.
when (not keep && List.null items') do
......@@ -880,10 +962,10 @@ reduceCStatement smt labs ctx = case smt of
("remove the for loop", C.posOf ni)
(reduceCStatement (C.CCompound [] [C.CBlockDecl d, C.CBlockStmt s] C.undefNode) labs ctx)
do
(bt, spec') <- evalStateT (updateCDeclarationSpecifiers keepAll spec) ctx
(bt, spec') <- joinLiftMaybe $ updateCDeclarationSpecifiers keepAll ctx spec
(items', ctx') <- flip runStateT ctx do
markDeleted items
collect (reduceCDeclarationItem bt) items
collect (reduceCDeclarationItem bt False) items
e2' <- runMaybeT do
e2' <- liftMaybe e2
re2' <- liftMaybe (reduceCExpr e2' etAny ctx')
......@@ -1095,11 +1177,10 @@ inferType ctx = \case
else inferType ctx lhs
C.CCast decl@(C.CDecl spec items _) _ _ -> do
-- todo is this a good handling of this?
(bt, _) <- evalStateT (updateCDeclarationSpecifiers keepAll spec) ctx
bt <- typeFromCDeclarationSpecifiers ctx spec
case items of
[C.CDeclarationItem (C.CDeclr Nothing dd Nothing [] _) _ _] -> do
(t, _) <- evalStateT (updateCDerivedDeclarators bt (repeat True) dd) ctx
pure t
typeFromCDerivedDeclarators bt ctx dd
[] ->
pure bt
_ow -> notSupportedYet' decl
......@@ -1162,7 +1243,7 @@ reduceCExpr expr t ctx = case expr of
l' <- rl
r' <- rr
pure $ C.CAssign o l' r' ni
C.CVar i _ ->
C.CVar i _ -> do
case lookupVariable ctx i of
IEKeep c -> do
-- case i of
......@@ -1260,16 +1341,24 @@ reduceCExpr expr t ctx = case expr of
pure $ C.CCond et' (Just ec') ef' ni
C.CCast (C.CDecl spec items ni2) e ni -> do
msplit ("do not cast", C.posOf ni) (reduceCExpr e t ctx) do
(bt, spec') <- evalStateT (updateCDeclarationSpecifiers keepAll spec) ctx
(items', re) <- case items of
fn <- updateCDeclarationSpecifiers keepAll ctx spec
hole <- case items of
[C.CDeclarationItem (C.CDeclr Nothing dd Nothing [] a) b c] -> do
e' <- reduceCExpr e etAny ctx
Just do
(bt, spec') <- fn
(_, dd') <- evalStateT (updateCDerivedDeclarators bt (repeat True) dd) ctx
([C.CDeclarationItem (C.CDeclr Nothing dd' Nothing [] a) b c],) <$> do
reduceCExpr e etAny ctx
[] -> ([],) <$> reduceCExpr e etAny ctx
ee' <- e'
pure (spec', [C.CDeclarationItem (C.CDeclr Nothing dd' Nothing [] a) b c], ee')
[] -> do
e' <- reduceCExpr e etAny ctx
Just do
(_, spec') <- fn
ee' <- e'
pure (spec', [], ee')
a -> notSupportedYet a ni
Just do
e' <- re
(spec', items', e') <- hole
pure (C.CCast (C.CDecl spec' items' ni2) e' ni)
C.CIndex e1 e2 ni -> do
msplit ("reduce to indexee", C.posOf e1) (reduceCExpr e1 t ctx) do
......@@ -1376,6 +1465,7 @@ data Keyword
| DoNoops
| ComputeFunctionFixpoint
| InlineTypeDefs
| InitializeVariables
| NoSemantics
| AllowEmptyDeclarations
| DisallowVariableInlining
......
static int g_62 = 3L;
static int g_62;
static int * g_116 = &g_62;
int main () { }
......
int a[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
int main () { }
int a = 0;
int a;
int main () {
for (a = 0;;) {
......
struct S0 {} b = {};
struct S0 {} b;
void f(int b, struct S0 a) {
}
int main () {
......
static int g_62 = 3L;
static int g_62;
static int * g_116 = &g_62;
int main()
{
......
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62 = 3L;
static int g_62;
static int * g_116 = &g_62;
int main()
{
......
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 1 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62;
static int * g_116;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 1 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 1 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62 = 3L;
static int g_62;
int * g_116 = &g_62;
int main()
{
......
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 1 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 1 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 1 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62;
int * g_116;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 1 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 1 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 1 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 1 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 inline variable g_116 at ("test/cases/small/addr.c": line 2)
static int * g_116 = 0;
......
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 1 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 1 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 inline variable g_116 at ("test/cases/small/addr.c": line 2)
int main()
......
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 1 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 1 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 delete variable at ("test/cases/small/addr.c": line 2)
static int * g_116;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 0 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 1 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 1 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 delete variable at ("test/cases/small/addr.c": line 2)
static int g_62 = 3L;
int main()
{
}
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 1 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 1 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 1 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 0 inline variable g_116 at ("test/cases/small/addr.c": line 2)
int * g_116 = 0;
......
// 1 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 1 inline variable g_62 at ("test/cases/small/addr.c": line 1)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 make declaration non-static at ("test/cases/small/addr.c": line 1)
// 1 delete uninitilized variable at ("test/cases/small/addr.c": line 1)
// 1 make declaration non-static at ("test/cases/small/addr.c": line 2)
// 0 remove initialization at ("test/cases/small/addr.c": line 2)
// 1 inline variable g_116 at ("test/cases/small/addr.c": line 2)
int main()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment