Skip to content
Snippets Groups Projects
Commit 0645913b authored by chrg's avatar chrg
Browse files

So far but slow

parent 3d4ad2ff
No related branches found
No related tags found
No related merge requests found
Showing
with 13853 additions and 52 deletions
...@@ -43,11 +43,11 @@ ...@@ -43,11 +43,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1709030659, "lastModified": 1709047585,
"narHash": "sha256-f0mIzef7HZaSlJ6VTUswugH1Ntt2kz5M4McSLG3cTCE=", "narHash": "sha256-qQ8zxtHNh1gOazW6/yTNpuMr3H1BLTNNSn4Z4aAXRHY=",
"owner": "kalhauge", "owner": "kalhauge",
"repo": "hspec-glitter", "repo": "hspec-glitter",
"rev": "ee38cf3ab038c51febd82c6ed486b018d9a4cdd4", "rev": "863c508adc0177459c2868146c3a9c68dda9d309",
"type": "github" "type": "github"
}, },
"original": { "original": {
......
--failure-report .hspec-failures --failure-report .hspec-failures
--rerun
--fail-fast --fail-fast
--rerun-all-on-success --rerun-all-on-success
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BlockArguments #-} {-# LANGUAGE BlockArguments #-}
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
...@@ -28,18 +29,28 @@ import Data.Data ...@@ -28,18 +29,28 @@ import Data.Data
import Data.Foldable import Data.Foldable
import Data.Function import Data.Function
import Data.Functor import Data.Functor
import qualified Data.List as List
import qualified Data.Map.Strict as Map import qualified Data.Map.Strict as Map
import Data.Maybe import Data.Maybe
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Vector.Internal.Check (HasCallStack) import Data.Vector.Internal.Check (HasCallStack)
-- import Debug.Trace
import qualified Language.C as C import qualified Language.C as C
import qualified Language.C.Data.Ident as C import qualified Language.C.Data.Ident as C
data Context = Context data Context = Context
{ keywords :: !(Set.Set Keyword) { keywords :: !(Set.Set Keyword)
, typeDefs :: !(Map.Map C.Ident [C.CDeclarationSpecifier C.NodeInfo]) , typeDefs :: !(Map.Map C.Ident [C.CDeclarationSpecifier C.NodeInfo])
, inlineExprs :: !(Map.Map C.Ident C.CExpr) , inlineExprs :: !(Map.Map C.Ident InlineType)
} }
deriving (Show)
data InlineType
= ITDelete
| ITInline !C.CExpr
| ITKeep
deriving (Show, Eq)
data Keyword data Keyword
= KeepMain = KeepMain
...@@ -62,7 +73,7 @@ addTypeDefs ids cs Context{..} = ...@@ -62,7 +73,7 @@ addTypeDefs ids cs Context{..} =
, .. , ..
} }
addInlineExpr :: C.Ident -> C.CExpr -> Context -> Context addInlineExpr :: C.Ident -> InlineType -> Context -> Context
addInlineExpr i e Context{..} = addInlineExpr i e Context{..} =
Context Context
{ inlineExprs = Map.insert i e inlineExprs { inlineExprs = Map.insert i e inlineExprs
...@@ -113,19 +124,30 @@ reduceCExternalDeclaration ...@@ -113,19 +124,30 @@ reduceCExternalDeclaration
-> Context -> Context
-> m [C.CExternalDeclaration C.NodeInfo] -> m [C.CExternalDeclaration C.NodeInfo]
reduceCExternalDeclaration r cont ctx = do reduceCExternalDeclaration r cont ctx = do
case inlineTypeDefs r ctx of -- TODO This is slow
case r of
C.CFDefExt fun C.CFDefExt fun
| KeepMain `isIn` ctx && maybe False (("main" ==) . C.identToString) (functionName fun) -> do | KeepMain `isIn` ctx && maybe False (("main" ==) . C.identToString) (functionName fun) -> do
r' <- C.CFDefExt <$> reduceCFunDef fun ctx r' <- C.CFDefExt <$> reduceCFunDef fun ctx
(r' :) <$> cont ctx (r' :) <$> cont ctx
| otherwise -> | otherwise ->
split ("remove function " <> maybe "" C.identToString (functionName fun), C.posOf r) (cont ctx) do case functionName fun of
Just fid -> do
split
("remove function " <> maybe "" C.identToString (functionName fun), C.posOf r)
(cont (addInlineExpr fid ITDelete ctx))
do
r' <- C.CFDefExt <$> reduceCFunDef fun ctx r' <- C.CFDefExt <$> reduceCFunDef fun ctx
(r' :) <$> case functionName fun of (r' :) <$> cont (addInlineExpr fid ITKeep ctx)
Just fid -> cont (addInlineExpr fid (C.CVar fid C.undefNode) ctx) Nothing -> do
Nothing -> cont ctx split
("remove function " <> maybe "" C.identToString (functionName fun), C.posOf r)
(cont ctx)
do
r' <- C.CFDefExt <$> reduceCFunDef fun ctx
(r' :) <$> cont ctx
C.CDeclExt result -> C.CDeclExt result ->
case result of case inlineTypeDefs result ctx of
-- A typedef -- A typedef
C.CDecl (C.CStorageSpec (C.CTypedef n) : rst) decl _ -> do C.CDecl (C.CStorageSpec (C.CTypedef n) : rst) decl _ -> do
let [ids] = identifiers decl let [ids] = identifiers decl
...@@ -147,16 +169,24 @@ reduceCExternalDeclaration r cont ctx = do ...@@ -147,16 +169,24 @@ reduceCExternalDeclaration r cont ctx = do
_r -> don'tHandle r _r -> don'tHandle r
reduceCFunDef reduceCFunDef
:: (MonadReduce Lab m) :: (MonadReduce Lab m, HasCallStack)
=> C.CFunctionDef C.NodeInfo => C.CFunctionDef C.NodeInfo
-> Context -> Context
-> m (C.CFunctionDef C.NodeInfo) -> m (C.CFunctionDef C.NodeInfo)
reduceCFunDef (C.CFunDef spc dec cdecls smt ni) ctx = do reduceCFunDef (C.CFunDef spc dec cdecls smt ni) ctx = do
smt' <- reduceCStatementOrEmptyBlock smt ctx smt' <- reduceCStatementOrEmptyBlock smt ctx'
pure $ C.CFunDef spc dec cdecls smt' ni pure $
C.CFunDef
(inlineTypeDefs spc ctx)
(inlineTypeDefs dec ctx)
(inlineTypeDefs cdecls ctx)
smt'
ni
where
!ctx' = foldr (`addInlineExpr` ITKeep) ctx (identifiers dec)
reduceCCompoundBlockItem reduceCCompoundBlockItem
:: (MonadReduce Lab m) :: (MonadReduce Lab m, HasCallStack)
=> C.CCompoundBlockItem C.NodeInfo => C.CCompoundBlockItem C.NodeInfo
-> (Context -> m [C.CCompoundBlockItem C.NodeInfo]) -> (Context -> m [C.CCompoundBlockItem C.NodeInfo])
-> Context -> Context
...@@ -182,9 +212,9 @@ reduceCCompoundBlockItem r cont ctx = do ...@@ -182,9 +212,9 @@ reduceCCompoundBlockItem r cont ctx = do
[] []
| AllowEmptyDeclarations `isIn` ctx' -> | AllowEmptyDeclarations `isIn` ctx' ->
split ("remove empty declaration", C.posOf r) (cont ctx') do split ("remove empty declaration", C.posOf r) (cont ctx') do
(C.CBlockDecl (C.CDecl rec decl' ni') :) <$> cont ctx' (C.CBlockDecl (inlineTypeDefs (C.CDecl rec decl' ni') ctx) :) <$> cont ctx'
| otherwise -> cont ctx' | otherwise -> cont ctx'
_ow -> (C.CBlockDecl (C.CDecl rec decl' ni') :) <$> cont ctx' _ow -> (C.CBlockDecl (inlineTypeDefs (C.CDecl rec decl' ni') ctx) :) <$> cont ctx'
d -> don'tHandle d d -> don'tHandle d
a -> don'tHandle a a -> don'tHandle a
...@@ -202,22 +232,24 @@ reduceCDeclarationItem d ma = case d of ...@@ -202,22 +232,24 @@ reduceCDeclarationItem d ma = case d of
c' <- fromMaybe (pure zeroExpr) (reduceCExpr c ctx) c' <- fromMaybe (pure zeroExpr) (reduceCExpr c ctx)
split split
("inline variable " <> C.identToString i, C.posOf ni) ("inline variable " <> C.identToString i, C.posOf ni)
(pure (ds, addInlineExpr i c' ctx)) (pure (ds, addInlineExpr i (ITInline c') ctx))
( pure ( pure
( C.CDeclarationItem dr (Just (C.CInitExpr c' ni')) Nothing : ds ( C.CDeclarationItem dr (Just (C.CInitExpr c' ni')) Nothing : ds
, addInlineExpr i (C.CVar i ni) ctx , addInlineExpr i ITKeep ctx
) )
) )
C.CDeclarationItem (C.CDeclr (Just i) _ Nothing [] ni) Nothing Nothing -> do C.CDeclarationItem (C.CDeclr (Just i) _ Nothing _ ni) _ Nothing -> do
(ds, ctx) <- ma (ds, ctx) <- ma
split split
("remove variable " <> C.identToString i, C.posOf ni) ("remove variable " <> C.identToString i, C.posOf ni)
(pure (ds, ctx)) (pure (ds, addInlineExpr i ITDelete ctx))
(pure (d : ds, addInlineExpr i (C.CVar i ni) ctx)) (pure (d : ds, addInlineExpr i ITKeep ctx))
a@(C.CDeclarationItem (C.CDeclr _ _ _ _ ni) _ _) -> do
don'tHandleWithNodeInfo a ni
a -> don'tHandle a a -> don'tHandle a
reduceCStatementOrEmptyBlock reduceCStatementOrEmptyBlock
:: (MonadReduce Lab m) :: (MonadReduce Lab m, HasCallStack)
=> C.CStatement C.NodeInfo => C.CStatement C.NodeInfo
-> Context -> Context
-> m (C.CStatement C.NodeInfo) -> m (C.CStatement C.NodeInfo)
...@@ -231,7 +263,7 @@ reduceCStatementOrEmptyBlock stmt ctx = do ...@@ -231,7 +263,7 @@ reduceCStatementOrEmptyBlock stmt ctx = do
emptyBlock = C.CCompound [] [] C.undefNode emptyBlock = C.CCompound [] [] C.undefNode
reduceCStatement reduceCStatement
:: (MonadReduce Lab m) :: (MonadReduce Lab m, HasCallStack)
=> C.CStatement C.NodeInfo => C.CStatement C.NodeInfo
-> Context -> Context
-> Maybe (m (C.CStatement C.NodeInfo)) -> Maybe (m (C.CStatement C.NodeInfo))
...@@ -322,12 +354,14 @@ reduceCStatement smt ctx = case smt of ...@@ -322,12 +354,14 @@ reduceCStatement smt ctx = case smt of
pure $ C.CFor e1' e2' e3' s' ni pure $ C.CFor e1' e2' e3' s' ni
C.CBreak ni -> Just do C.CBreak ni -> Just do
pure (C.CBreak ni) pure (C.CBreak ni)
C.CCont ni -> Just do
pure (C.CCont ni)
C.CLabel i s [] ni -> Just do C.CLabel i s [] ni -> Just do
s' <- reduceCStatementOrEmptyBlock s ctx s' <- reduceCStatementOrEmptyBlock s ctx
pure $ C.CLabel i s' [] ni pure $ C.CLabel i s' [] ni
C.CGoto i ni -> Just do C.CGoto i ni -> Just do
pure $ C.CGoto i ni pure $ C.CGoto i ni
a -> don'tHandle a a -> don'tHandleWithPos a
-- C.CCompound is cbi ni -> do -- C.CCompound is cbi ni -> do
-- cbi' <- collect (reduce @C.CCompoundBlockItem) cbi -- cbi' <- collect (reduce @C.CCompoundBlockItem) cbi
...@@ -340,7 +374,6 @@ reduceCStatement smt ctx = case smt of ...@@ -340,7 +374,6 @@ reduceCStatement smt ctx = case smt of
-- C.CReturn e ni -> do -- C.CReturn e ni -> do
-- e' <- traverse (fmap orZero reduce) e -- e' <- traverse (fmap orZero reduce) e
-- pure $ C.CReturn e' ni -- pure $ C.CReturn e' ni
-- C.CCont ni -> pure (C.CCont ni)
-- C.CLabel i s [] ni -> do -- C.CLabel i s [] ni -> do
-- -- todo fix attrs -- -- todo fix attrs
-- s' <- reduce s -- s' <- reduce s
...@@ -368,7 +401,7 @@ maybeSplit lab = \case ...@@ -368,7 +401,7 @@ maybeSplit lab = \case
zeroExpr :: C.CExpression C.NodeInfo zeroExpr :: C.CExpression C.NodeInfo
zeroExpr = C.CConst (C.CIntConst (C.cInteger 0) C.undefNode) zeroExpr = C.CConst (C.CIntConst (C.cInteger 0) C.undefNode)
reduceCExprOrZero :: (MonadReduce Lab m) => C.CExpr -> Context -> m C.CExpr reduceCExprOrZero :: (MonadReduce Lab m, HasCallStack) => C.CExpr -> Context -> m C.CExpr
reduceCExprOrZero expr ctx = do reduceCExprOrZero expr ctx = do
case reduceCExpr expr ctx of case reduceCExpr expr ctx of
Just ex -> do Just ex -> do
...@@ -376,7 +409,7 @@ reduceCExprOrZero expr ctx = do ...@@ -376,7 +409,7 @@ reduceCExprOrZero expr ctx = do
Nothing -> do Nothing -> do
pure zeroExpr pure zeroExpr
reduceCExpr :: (MonadReduce Lab m) => C.CExpr -> Context -> Maybe (m C.CExpr) reduceCExpr :: (MonadReduce Lab m, HasCallStack) => C.CExpr -> Context -> Maybe (m C.CExpr)
reduceCExpr expr ctx = case expr of reduceCExpr expr ctx = case expr of
C.CBinary o elhs erhs ni -> do C.CBinary o elhs erhs ni -> do
case reduceCExpr elhs ctx of case reduceCExpr elhs ctx of
...@@ -407,11 +440,13 @@ reduceCExpr expr ctx = case expr of ...@@ -407,11 +440,13 @@ reduceCExpr expr ctx = case expr of
C.CVar i _ -> C.CVar i _ ->
case Map.lookup i . inlineExprs $ ctx of case Map.lookup i . inlineExprs $ ctx of
Just mx -> case mx of Just mx -> case mx of
C.CVar _ _ -> pure (pure mx) ITKeep -> Just (pure expr)
_ ITInline mx'
| DisallowVariableInlining `isIn` ctx -> Nothing | DisallowVariableInlining `isIn` ctx -> Nothing
| otherwise -> pure (pure mx) | otherwise -> Just (pure mx')
Nothing -> fail ("Could not find " <> show i) ITDelete ->
Nothing
Nothing -> error ("Could not find " <> show i <> " at " <> show (C.posOf expr) <> "\n" <> show (inlineExprs ctx))
C.CConst x -> Just do C.CConst x -> Just do
pure $ C.CConst x pure $ C.CConst x
C.CUnary o elhs ni -> do C.CUnary o elhs ni -> do
...@@ -425,14 +460,45 @@ reduceCExpr expr ctx = case expr of ...@@ -425,14 +460,45 @@ reduceCExpr expr ctx = case expr of
e' <- re e' <- re
es' <- traverse (`reduceCExprOrZero` ctx) es es' <- traverse (`reduceCExprOrZero` ctx) es
pure $ C.CCall e' es' ni pure $ C.CCall e' es' ni
a -> error (show a) C.CCond ec et ef ni -> do
-- TODO: More fine grained reduction is possible here.
-- C.CCond ec et ef ni -> do Just $ do
-- ec' <- reduce ec ec' <- reduceCExprOrZero ec ctx
-- ef' <- reduce ef ef' <- reduceCExprOrZero ef ctx
-- et' <- optional do et' <- case et of
-- et' <- liftMaybe et Just et' -> Just <$> reduceCExprOrZero et' ctx
-- reduce et' Nothing -> pure Nothing
pure $ C.CCond ec' et' ef' ni
C.CCast decl e ni -> do
re <- reduceCExpr e ctx
Just do
split ("don't cast", C.posOf ni) re do
e' <- re
pure (C.CCast decl e' ni)
C.CIndex e1 e2 ni -> do
-- TODO: Better reduction is posisble here.
re1 <- reduceCExpr e1 ctx
Just do
e1' <- re1
e2' <- reduceCExprOrZero e2 ctx
pure $ C.CIndex e1' e2' ni
C.CComma items ni -> Just do
let Just (x, rst) = List.uncons (reverse items)
rst' <-
foldr
( \e cc -> do
maybeSplit ("remove expression", C.posOf e) (reduceCExpr e ctx) >>= \case
Just e' -> (e' :) <$> cc
Nothing -> cc
)
(pure [])
rst
x' <- reduceCExprOrZero x ctx
if List.null rst'
then pure x'
else pure $ C.CComma (reverse (x' : rst')) ni
a -> don'tHandleWithPos a
-- pure $ C.CCond ec' et' ef' ni -- pure $ C.CCond ec' et' ef' ni
-- C.CBinary o elhs erhs ni -> onBothExpr elhs erhs \lhs rhs -> -- C.CBinary o elhs erhs ni -> onBothExpr elhs erhs \lhs rhs ->
-- pure $ C.CBinary o lhs rhs ni -- pure $ C.CBinary o lhs rhs ni
...@@ -442,21 +508,10 @@ reduceCExpr expr ctx = case expr of ...@@ -442,21 +508,10 @@ reduceCExpr expr ctx = case expr of
-- C.CConst c -> do -- C.CConst c -> do
-- -- TODO fix -- -- TODO fix
-- pure $ C.CConst c -- pure $ C.CConst c
-- C.CCast cd e ni -> do
-- -- TODO fix
-- cd' <- reduce @C.CDeclaration cd
-- e' <- reduce e
-- pure $ C.CCast cd' e' ni
-- C.CIndex e1 e2 ni -> do
-- e1' <- reduce e1
-- e2' <- orZero (reduce e2)
-- pure $ C.CIndex e1' e2' ni
-- C.CMember e i b ni -> do -- C.CMember e i b ni -> do
-- givenThat (Val.is i) -- givenThat (Val.is i)
-- e' <- reduce e -- e' <- reduce e
-- pure $ C.CMember e' i b ni -- pure $ C.CMember e' i b ni
-- C.CComma items ni -> do
-- C.CComma <$> collectNonEmpty' reduce items <*> pure ni
-- e -> error (show e) -- e -> error (show e)
-- where -- where
-- onBothExpr elhs erhs = onBoth (reduce elhs) (reduce erhs) -- onBothExpr elhs erhs = onBoth (reduce elhs) (reduce erhs)
...@@ -535,6 +590,12 @@ functionName = \case ...@@ -535,6 +590,12 @@ functionName = \case
don'tHandle :: (HasCallStack, Functor f, Show (f ())) => f C.NodeInfo -> b don'tHandle :: (HasCallStack, Functor f, Show (f ())) => f C.NodeInfo -> b
don'tHandle f = error (show (f $> ())) don'tHandle f = error (show (f $> ()))
don'tHandleWithPos :: (HasCallStack, Functor f, Show (f ()), C.Pos (f C.NodeInfo)) => f C.NodeInfo -> b
don'tHandleWithPos f = error (show (f $> ()) <> " at " <> show (C.posOf f))
don'tHandleWithNodeInfo :: (HasCallStack, Functor f, Show (f ())) => f C.NodeInfo -> C.NodeInfo -> b
don'tHandleWithNodeInfo f ni = error (show (f $> ()) <> " at " <> show (C.posOf ni))
-- instance CReducible C.CDeclaration where -- instance CReducible C.CDeclaration where
-- reduce = \case -- reduce = \case
-- C.CDecl spc@(C.CStorageSpec (C.CTypedef _) : rst) decl ni -> do -- C.CDecl spc@(C.CStorageSpec (C.CTypedef _) : rst) decl ni -> do
......
This diff is collapsed.
int add(int a, int b) {
return a + b;
}
int main() {
return add(10, 23);
}
int add(int a, int b)
{
return a + b;
}
int main()
{
return add(10, 23);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 0 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a + b;
}
int main()
{
return add(10, 23);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 0 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a + b;
}
int main()
{
return add(10, 0);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 0 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a + b;
}
int main()
{
return add(0, 23);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 0 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a + b;
}
int main()
{
return add(0, 0);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 0 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a + b;
}
int main()
{
return 0;
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 0 reduce to right at ("test/cases/small/add.c": line 2)
// 1 remove statement at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a + b;
}
int main()
{
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 1 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return b;
}
int main()
{
return add(10, 23);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 1 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return b;
}
int main()
{
return add(10, 0);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 1 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return b;
}
int main()
{
return add(0, 23);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 1 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return b;
}
int main()
{
return add(0, 0);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 1 reduce to right at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return b;
}
int main()
{
return 0;
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 0 reduce to left at ("test/cases/small/add.c": line 2)
// 1 reduce to right at ("test/cases/small/add.c": line 2)
// 1 remove statement at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return b;
}
int main()
{
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 1 reduce to left at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a;
}
int main()
{
return add(10, 23);
}
// 0 remove function add at ("test/cases/small/add.c": line 1)
// 0 remove statement at ("test/cases/small/add.c": line 2)
// 0 replace by zero at ("test/cases/small/add.c": line 2)
// 1 reduce to left at ("test/cases/small/add.c": line 2)
// 0 remove statement at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 0 replace by zero at ("test/cases/small/add.c": line 6)
// 1 replace by zero at ("test/cases/small/add.c": line 6)
int add(int a, int b)
{
return a;
}
int main()
{
return add(10, 0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment